]> gitweb.factorcode.org Git - factor.git/commitdiff
Add fuel-test-vocab to FUEL (C-ct default) to run unit tests on a vocab
authorerikc <erikcharlebois@gmail.com>
Mon, 8 Feb 2010 23:58:40 +0000 (15:58 -0800)
committererikc <erikcharlebois@gmail.com>
Mon, 8 Feb 2010 23:58:40 +0000 (15:58 -0800)
misc/fuel/README
misc/fuel/fuel-completion.el
misc/fuel/fuel-listener.el
misc/fuel/fuel-mode.el
misc/fuel/fuel-syntax.el

index 0411e0709bf86bd09d46862d1a335c16f513e4a8..ccaa7a676a29f3877676b257a26eb0f2e6b0d091 100644 (file)
@@ -99,6 +99,7 @@ beast.
     |-----------------+------------------------------------------------------------|
     | C-cz            | switch to listener (run-factor)                            |
     | C-co            | cycle between code, tests and docs files                   |
+    | C-ct            | run the unit tests for a vocabulary                        |
     | C-cr            | switch to listener and refresh all loaded vocabs           |
     | C-cs            | switch to other factor buffer (fuel-switch-to-buffer)      |
     | C-x4s           | switch to other factor buffer in other window              |
index c21d25901f9e742a69adb5d98c973e7bf4d43213..8d782252739c7f7251e854570a22beff398c52aa 100644 (file)
@@ -190,13 +190,13 @@ terminates a current completion."
 
 (defvar fuel-completion--vocab-history nil)
 
-(defun fuel-completion--read-vocab (refresh)
+(defun fuel-completion--read-vocab (refresh &optional init-input)
   (let ((minibuffer-local-completion-map fuel-completion--minibuffer-map)
         (vocabs (fuel-completion--vocabs refresh))
         (prompt "Vocabulary name: "))
     (if vocabs
-        (completing-read prompt vocabs nil nil nil fuel-completion--vocab-history)
-      (read-string prompt nil fuel-completion--vocab-history))))
+        (completing-read prompt vocabs nil nil init-input fuel-completion--vocab-history)
+      (read-string prompt init-input fuel-completion--vocab-history))))
 
 (defun fuel-completion--complete-symbol ()
   "Complete the symbol at point.
index 1d23571a0abda5173627a68cc977fefdba024e58..d5fec4bf5f2d3c4f92ef9486152923314ce57ffa 100644 (file)
@@ -192,6 +192,13 @@ With prefix, you're teletransported to the listener's buffer."
     (comint-send-string nil "\"Refreshing loaded vocabs...\" write nl flush")
     (comint-send-string nil " refresh-all \"Done!\" write nl flush\n")))
 
+(defun fuel-test-vocab (vocab)
+  "Run the unit tests for the specified vocabulary."
+  (interactive (list (fuel-completion--read-vocab nil (fuel-syntax--current-vocab))))
+  (comint-send-string (fuel-listener--process)
+                      (concat "\"" vocab "\" reload nl flush\n"
+                              "\"" vocab "\" test nl flush\n")))
+
 \f
 ;;; Completion support
 
index 282ef3240f15ae83f5cdcedaec1be22ad2e33dc4..6f42b4efc423880aec89563848e4e926e1f780e2 100644 (file)
@@ -191,6 +191,7 @@ interacting with a factor listener is at your disposal.
 (fuel-mode--key-1 ?k 'fuel-run-file)
 (fuel-mode--key-1 ?l 'fuel-run-file)
 (fuel-mode--key-1 ?r 'fuel-refresh-all)
+(fuel-mode--key-1 ?t 'fuel-test-vocab)
 (fuel-mode--key-1 ?z 'run-factor)
 (fuel-mode--key-1 ?s 'fuel-switch-to-buffer)
 (define-key fuel-mode-map "\C-x4s" 'fuel-switch-to-buffer-other-window)
index 635bf0ea82ad4c24cb6200606b48014404ad300a..c22d03bdc5d4cbdd0eb1a42d84ed0597ccf025e8 100644 (file)
@@ -50,7 +50,8 @@
     "DEFER:"
     "EBNF:" ";EBNF" "ERROR:" "EXCLUDE:"
     "f" "FORGET:" "FROM:" "FUNCTION:"
-    "GENERIC#" "GENERIC:"
+    "GAME:" "GENERIC#" "GENERIC:"
+    "GLSL-SHADER:" "GLSL-PROGRAM:"
     "HELP:" "HEX:" "HOOK:"
     "IN:" "initial:" "INSTANCE:" "INTERSECTION:"
     "LIBRARY:"
     "POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROVIDE:"
     "QUALIFIED-WITH:" "QUALIFIED:"
     "read-only" "RENAME:" "REQUIRE:"  "REQUIRES:"
-    "SINGLETON:" "SINGLETONS:" "SLOT:" "SYMBOL:" "SYMBOLS:" "SYNTAX:"
-    "TUPLE:" "t" "t?" "TYPEDEF:"
-    "UNION:" "USE:" "USING:"
-    "VARS:"))
+    "SINGLETON:" "SINGLETONS:" "SLOT:" "STRING:" "SYMBOL:" "SYMBOLS:" "SYNTAX:"
+    "TUPLE:" "t" "t?" "TYPEDEF:" "TYPED:" "TYPED::"
+    "UNIFORM-TUPLE:" "UNION:" "USE:" "USING:"
+    "VARS:" "VERTEX-FORMAT:"))
 
 (defconst fuel-syntax--parsing-words-regex
   (regexp-opt fuel-syntax--parsing-words 'words))
   (format "\\_<\\(%s\\)?: +\\_<\\(\\w+\\)\\_>"
           (regexp-opt
            '(":" "GENERIC" "DEFER" "HOOK" "MAIN" "MATH" "POSTPONE"
-             "SYMBOL" "SYNTAX" "RENAME"))))
+             "SYMBOL" "SYNTAX" "TYPED" "RENAME"))))
 
 (defconst fuel-syntax--alias-definition-regex
   "^ALIAS: +\\(\\_<.+?\\_>\\) +\\(\\_<.+?\\_>\\)")
                                            "MEMO" "MEMO:" "METHOD"
                                            "SYNTAX"
                                            "PREDICATE" "PRIMITIVE"
-                                           "STRUCT" "TAG" "TUPLE" "UNION-STRUCT"
-                                           "UNION"))
+                                           "STRUCT" "TAG" "TUPLE"
+                                           "TYPED" "TYPED:"
+                                           "UNIFORM-TUPLE"
+                                           "UNION-STRUCT" "UNION"
+                                           "VERTEX-FORMAT"))
 
 (defconst fuel-syntax--no-indent-def-starts '("ARTICLE"
                                               "HELP"
                 "CONSTANT:" "C:"
                 "DEFER:"
                 "FORGET:"
-                "GENERIC:" "GENERIC#"
+                "GAME:" "GENERIC:" "GENERIC#" "GLSL-PROGRAM:" 
                 "HEX:" "HOOK:"
                 "IN:" "INSTANCE:"
                 "LIBRARY:"