]> gitweb.factorcode.org Git - factor.git/commitdiff
vocabs.refresh: Add variants of refresh(-all) that run unit-tests
authortimor <timor.dd@googlemail.com>
Wed, 26 May 2021 18:13:29 +0000 (20:13 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 2 Jun 2021 15:31:35 +0000 (09:31 -0600)
Bound to Shift-F2 per default in the UI Tools windows.

basis/tools/test/test-docs.factor
basis/tools/test/test.factor
basis/ui/tools/tools.factor

index 9253d251f9b543fefbd05a20b404dc9d177844e0..428b9aa1657c117cac22256cbf04686432b7f416 100644 (file)
@@ -1,4 +1,4 @@
-USING: help.markup help.syntax kernel quotations io ;
+USING: help.markup help.syntax kernel quotations io strings vocabs.refresh ;
 IN: tools.test
 
 ARTICLE: "tools.test" "Unit testing"
@@ -83,6 +83,16 @@ HELP: test
 HELP: test-all
 { $description "Runs unit tests for all loaded vocabularies." } ;
 
+HELP: refresh-and-test
+{ $values { "prefix" string } }
+{ $description "Like " { $link refresh } ", but runs unit tests for all reloaded vocabularies afterwards." } ;
+
+HELP: refresh-and-test-all
+{ $values { "prefix" string } }
+{ $description "Like " { $link refresh-all } ", but runs unit tests for all reloaded vocabularies afterwards." } ;
+
+{ refresh-and-test refresh-and-test-all } related-words
+
 HELP: :test-failures
 { $description "Prints all pending unit test failures." } ;
 
index 2bb5a380c1803b9b89b7e02db79708e23f562c27..38769d880c989a9c38ea15d04adeee6c9086ea06 100644 (file)
@@ -8,7 +8,7 @@ sequences.generalizations source-files source-files.errors
 source-files.errors.debugger splitting stack-checker summary
 system tools.errors tools.time unicode vocabs vocabs.files
 vocabs.hierarchy vocabs.hierarchy.private vocabs.loader
-vocabs.metadata vocabs.parser words ;
+vocabs.metadata vocabs.parser vocabs.refresh words ;
 IN: tools.test
 
 TUPLE: test-failure < source-file-error continuation ;
@@ -226,6 +226,10 @@ M: test-failure error. ( error -- )
 
 : test-all ( -- ) "" test ;
 
+: refresh-and-test ( prefix --  ) to-refresh [ do-refresh ] keepdd test-vocabs ;
+
+: refresh-and-test-all ( -- ) "" refresh-and-test ;
+
 : test-main ( -- )
     command-line get [
         dup vocab-roots get member? [
index ed7ea6f6c0b14ad7cbad771fbcf214ef96ed5679..3a27e0249784c2c26c2178b83abd8b19db8eb65e 100644 (file)
@@ -1,12 +1,14 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel literals memory namespaces sequences system ui
+USING: kernel literals memory namespaces sequences system
+tools.test ui
 ui.backend ui.commands ui.gestures ui.tools.browser
 ui.tools.common ui.tools.error-list ui.tools.listener
 vocabs.refresh ;
 IN: ui.tools
 
 \ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
+\ refresh-and-test-all H{ { +nullary+ t } { +listener+ t } } define-command
 
 \ save H{ { +nullary+ t } } define-command
 
@@ -25,6 +27,7 @@ tool "common" f {
     { T{ key-down f ${ os macosx? M+ C+ ? } "w" } close-window }
     { T{ key-down f ${ os macosx? M+ C+ ? } "q" } com-exit }
     { T{ key-down f f "F2" } refresh-all }
+    { T{ key-down f { S+ } "F2" } refresh-and-test-all }
     { T{ key-down f f "F3" } show-error-list }
 } os macosx? {
     { T{ key-down f { C+ M+ } "f" } toggle-fullscreen }