Add fuel-test-vocab to FUEL (C-ct default) to run unit tests on a vocab

db4
erikc 2010-02-08 15:58:40 -08:00
parent 97e6315c47
commit c4bd780bff
5 changed files with 25 additions and 12 deletions

View File

@ -99,6 +99,7 @@ beast.
|-----------------+------------------------------------------------------------| |-----------------+------------------------------------------------------------|
| C-cz | switch to listener (run-factor) | | C-cz | switch to listener (run-factor) |
| C-co | cycle between code, tests and docs files | | 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-cr | switch to listener and refresh all loaded vocabs |
| C-cs | switch to other factor buffer (fuel-switch-to-buffer) | | C-cs | switch to other factor buffer (fuel-switch-to-buffer) |
| C-x4s | switch to other factor buffer in other window | | C-x4s | switch to other factor buffer in other window |

View File

@ -190,13 +190,13 @@ terminates a current completion."
(defvar fuel-completion--vocab-history nil) (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) (let ((minibuffer-local-completion-map fuel-completion--minibuffer-map)
(vocabs (fuel-completion--vocabs refresh)) (vocabs (fuel-completion--vocabs refresh))
(prompt "Vocabulary name: ")) (prompt "Vocabulary name: "))
(if vocabs (if vocabs
(completing-read prompt vocabs nil nil nil fuel-completion--vocab-history) (completing-read prompt vocabs nil nil init-input fuel-completion--vocab-history)
(read-string prompt nil fuel-completion--vocab-history)))) (read-string prompt init-input fuel-completion--vocab-history))))
(defun fuel-completion--complete-symbol () (defun fuel-completion--complete-symbol ()
"Complete the symbol at point. "Complete the symbol at point.

View 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 "\"Refreshing loaded vocabs...\" write nl flush")
(comint-send-string nil " refresh-all \"Done!\" write nl flush\n"))) (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")))
;;; Completion support ;;; Completion support

View 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 ?k 'fuel-run-file)
(fuel-mode--key-1 ?l 'fuel-run-file) (fuel-mode--key-1 ?l 'fuel-run-file)
(fuel-mode--key-1 ?r 'fuel-refresh-all) (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 ?z 'run-factor)
(fuel-mode--key-1 ?s 'fuel-switch-to-buffer) (fuel-mode--key-1 ?s 'fuel-switch-to-buffer)
(define-key fuel-mode-map "\C-x4s" 'fuel-switch-to-buffer-other-window) (define-key fuel-mode-map "\C-x4s" 'fuel-switch-to-buffer-other-window)

View File

@ -50,7 +50,8 @@
"DEFER:" "DEFER:"
"EBNF:" ";EBNF" "ERROR:" "EXCLUDE:" "EBNF:" ";EBNF" "ERROR:" "EXCLUDE:"
"f" "FORGET:" "FROM:" "FUNCTION:" "f" "FORGET:" "FROM:" "FUNCTION:"
"GENERIC#" "GENERIC:" "GAME:" "GENERIC#" "GENERIC:"
"GLSL-SHADER:" "GLSL-PROGRAM:"
"HELP:" "HEX:" "HOOK:" "HELP:" "HEX:" "HOOK:"
"IN:" "initial:" "INSTANCE:" "INTERSECTION:" "IN:" "initial:" "INSTANCE:" "INTERSECTION:"
"LIBRARY:" "LIBRARY:"
@ -60,10 +61,10 @@
"POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROVIDE:" "POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROVIDE:"
"QUALIFIED-WITH:" "QUALIFIED:" "QUALIFIED-WITH:" "QUALIFIED:"
"read-only" "RENAME:" "REQUIRE:" "REQUIRES:" "read-only" "RENAME:" "REQUIRE:" "REQUIRES:"
"SINGLETON:" "SINGLETONS:" "SLOT:" "SYMBOL:" "SYMBOLS:" "SYNTAX:" "SINGLETON:" "SINGLETONS:" "SLOT:" "STRING:" "SYMBOL:" "SYMBOLS:" "SYNTAX:"
"TUPLE:" "t" "t?" "TYPEDEF:" "TUPLE:" "t" "t?" "TYPEDEF:" "TYPED:" "TYPED::"
"UNION:" "USE:" "USING:" "UNIFORM-TUPLE:" "UNION:" "USE:" "USING:"
"VARS:")) "VARS:" "VERTEX-FORMAT:"))
(defconst fuel-syntax--parsing-words-regex (defconst fuel-syntax--parsing-words-regex
(regexp-opt fuel-syntax--parsing-words 'words)) (regexp-opt fuel-syntax--parsing-words 'words))
@ -110,7 +111,7 @@
(format "\\_<\\(%s\\)?: +\\_<\\(\\w+\\)\\_>" (format "\\_<\\(%s\\)?: +\\_<\\(\\w+\\)\\_>"
(regexp-opt (regexp-opt
'(":" "GENERIC" "DEFER" "HOOK" "MAIN" "MATH" "POSTPONE" '(":" "GENERIC" "DEFER" "HOOK" "MAIN" "MATH" "POSTPONE"
"SYMBOL" "SYNTAX" "RENAME")))) "SYMBOL" "SYNTAX" "TYPED" "RENAME"))))
(defconst fuel-syntax--alias-definition-regex (defconst fuel-syntax--alias-definition-regex
"^ALIAS: +\\(\\_<.+?\\_>\\) +\\(\\_<.+?\\_>\\)") "^ALIAS: +\\(\\_<.+?\\_>\\) +\\(\\_<.+?\\_>\\)")
@ -159,8 +160,11 @@
"MEMO" "MEMO:" "METHOD" "MEMO" "MEMO:" "METHOD"
"SYNTAX" "SYNTAX"
"PREDICATE" "PRIMITIVE" "PREDICATE" "PRIMITIVE"
"STRUCT" "TAG" "TUPLE" "UNION-STRUCT" "STRUCT" "TAG" "TUPLE"
"UNION")) "TYPED" "TYPED:"
"UNIFORM-TUPLE"
"UNION-STRUCT" "UNION"
"VERTEX-FORMAT"))
(defconst fuel-syntax--no-indent-def-starts '("ARTICLE" (defconst fuel-syntax--no-indent-def-starts '("ARTICLE"
"HELP" "HELP"
@ -185,7 +189,7 @@
"CONSTANT:" "C:" "CONSTANT:" "C:"
"DEFER:" "DEFER:"
"FORGET:" "FORGET:"
"GENERIC:" "GENERIC#" "GAME:" "GENERIC:" "GENERIC#" "GLSL-PROGRAM:"
"HEX:" "HOOK:" "HEX:" "HOOK:"
"IN:" "INSTANCE:" "IN:" "INSTANCE:"
"LIBRARY:" "LIBRARY:"