diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 48417d6667..959368e831 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -19,7 +19,6 @@ - we need to optimize [ dup array? [ array? ] [ array? ] if ] - better way of dealing with compiler errors - track individual method usages -- modularize core - track module files and modification times, and a list of assets loaded from that file - 'changes' word, asks if files changed on disk from loaded modules diff --git a/contrib/vim/vim.factor b/contrib/vim/vim.factor index 438e167caa..e0cfcf6a3f 100644 --- a/contrib/vim/vim.factor +++ b/contrib/vim/vim.factor @@ -2,8 +2,6 @@ IN: vim USING: definitions embedded io kernel parser prettyprint process sequences namespaces ; -: file-modified stat fourth ; - : vim-location ( file line -- ) >r [ file-modified ] keep r> [ "vim \"" % over % "\" +" % # ] "" make system drop diff --git a/library/compiler/load.factor b/library/compiler/load.factor index 807275d58d..a6649c561d 100644 --- a/library/compiler/load.factor +++ b/library/compiler/load.factor @@ -55,7 +55,7 @@ PROVIDE: library/compiler { "test/bail-out.factor" "test/intrinsics.factor" "test/float.factor" - "test/identities" + "test/identities.factor" "test/optimizer.factor" "test/alien.factor" "test/callbacks.factor" diff --git a/library/io/files.factor b/library/io/files.factor index 2ad956df2c..9ba94cbd5d 100644 --- a/library/io/files.factor +++ b/library/io/files.factor @@ -19,6 +19,8 @@ strings styles ; : file-length ( path -- n ) stat third ; +: file-modified ( path -- n ) stat fourth ; + : parent-dir ( path -- parent ) CHAR: / over last-index CHAR: \\ pick last-index max dup -1 = [ 2drop "." ] [ head ] if ; diff --git a/library/load.factor b/library/load.factor index bccb2cb2e1..0026166323 100644 --- a/library/load.factor +++ b/library/load.factor @@ -95,8 +95,7 @@ PROVIDE: library { "tools/listener.factor" "tools/inspector.factor" "tools/word-tools.factor" - - "test/test.factor" + "tools/test.factor" "tools/interpreter.factor" @@ -179,7 +178,6 @@ PROVIDE: library { "syntax/parser.facts" "syntax/parse-syntax.facts" "syntax/prettyprint.facts" - "test/test.facts" "tools/definitions.facts" "tools/word-tools.facts" "tools/debugger.facts" @@ -188,6 +186,7 @@ PROVIDE: library { "tools/inspector.facts" "tools/listener.facts" "tools/memory.facts" + "tools/test.facts" } ! Test files { @@ -231,5 +230,5 @@ PROVIDE: library { "test/stream.factor" "test/threads.factor" "test/tuple.factor" - "test/words" + "test/words.factor" } ; diff --git a/library/modules.factor b/library/modules.factor index 1b70e6121e..d12c13d26d 100644 --- a/library/modules.factor +++ b/library/modules.factor @@ -49,10 +49,11 @@ SYMBOL: modules [ module-files run-resources ] keep dup module-name modules get set-hash ; -: test ( name -- ) module module-tests run-tests ; +: test-module ( name -- ) module module-tests run-tests ; -: tests ( -- ) - modules hash-keys [ module-tests ] map concat run-tests ; +: test-modules ( -- ) + modules get hash-values + [ module-tests ] map concat run-tests ; : modules. ( -- ) modules get hash-keys natural-sort [ print ] each ; diff --git a/library/modules.facts b/library/modules.facts index dc7e75ad7f..8bf45702ba 100644 --- a/library/modules.facts +++ b/library/modules.facts @@ -45,9 +45,9 @@ HELP: provide { $values { "name" "a string" } { "files" "a sequence of strings" } { "tests" "a sequence of strings" } } { $description "Registers a module definition and loads its source files. Usually instead of calling this word, module definitions use the parsing word " { $link POSTPONE: PROVIDE: } " instead." } ; -HELP: test +HELP: test-module { $values { "name" "a module name string" } } { $description "Runs the unit test files associated to the module by a previous call to " { $link provide } " or " { $link POSTPONE: PROVIDE: } "." } ; -HELP: tests +HELP: test-modules { $description "Runs unit test files for all loaded modules." } ; diff --git a/library/tools/definitions.factor b/library/tools/definitions.factor index ec218a6c33..df9120882a 100644 --- a/library/tools/definitions.factor +++ b/library/tools/definitions.factor @@ -5,7 +5,7 @@ USING: arrays errors generic hashtables io kernel math namespaces parser prettyprint sequences styles words ; : ?resource-path ( path -- path ) - "resource:/" ?head [ resource-path ] when ; + "resource:" ?head [ resource-path ] when ; : where ( defspec -- loc ) where* dup [ first2 >r ?resource-path r> 2array ] when ; diff --git a/library/test/test.factor b/library/tools/test.factor similarity index 98% rename from library/test/test.factor rename to library/tools/test.factor index 163b1a8629..29b10a767b 100644 --- a/library/test/test.factor +++ b/library/tools/test.factor @@ -44,7 +44,7 @@ SYMBOL: failures : test-handler ( name quot -- ? ) catch [ dup error. 2array failure f ] [ t ] if* ; -: test ( path -- ? ) +: run-test ( path -- ? ) [ "=====> " write dup write "..." print flush [ diff --git a/library/test/test.facts b/library/tools/test.facts similarity index 100% rename from library/test/test.facts rename to library/tools/test.facts