From dba24d93370d57e8307e6cdd6fdc8942578a2b57 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 23 Jul 2012 10:01:48 -0700 Subject: [PATCH] vocabs.files: adding a 'vocab-tests-path' that doesn't check for existence. --- basis/vocabs/files/files-docs.factor | 8 ++++++-- basis/vocabs/files/files.factor | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/basis/vocabs/files/files-docs.factor b/basis/vocabs/files/files-docs.factor index 61a2e68707..2f0ea76bdc 100644 --- a/basis/vocabs/files/files-docs.factor +++ b/basis/vocabs/files/files-docs.factor @@ -1,9 +1,13 @@ USING: help.markup help.syntax strings ; IN: vocabs.files -HELP: vocab-tests-file +HELP: vocab-tests-path { $values { "vocab" "a vocabulary specifier" } { "path" "pathname string to test file" } } -{ $description "Outputs a pathname where the unit test file is located." } ; +{ $description "Outputs a pathname where the unit test file for " { $snippet "vocab" } " is located. Outputs " { $link f } " if the vocabulary does not have a directory on disk." } ; + +HELP: vocab-tests-file +{ $values { "vocab" "a vocabulary specifier" } { "path/f" "pathname string to test file" } } +{ $description "Outputs a pathname where the unit test file is located, or " { $link f } " if the file does not exist." } ; HELP: vocab-tests-dir { $values { "vocab" "a vocabulary specifier" } { "paths" "a sequence of pathname strings" } } diff --git a/basis/vocabs/files/files.factor b/basis/vocabs/files/files.factor index 4739fc80da..68a6da6c13 100644 --- a/basis/vocabs/files/files.factor +++ b/basis/vocabs/files/files.factor @@ -4,8 +4,11 @@ USING: io.directories io.files io.pathnames kernel make sequences vocabs.loader ; IN: vocabs.files -: vocab-tests-file ( vocab -- path ) - dup "-tests.factor" append-vocab-dir vocab-append-path dup +: vocab-tests-path ( vocab -- path ) + dup "-tests.factor" append-vocab-dir vocab-append-path ; + +: vocab-tests-file ( vocab -- path/f ) + vocab-tests-path dup [ dup exists? [ drop f ] unless ] [ drop f ] if ; : vocab-tests-dir ( vocab -- paths )