aboutsummaryrefslogtreecommitdiff
path: root/sam-test.el
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2020-07-25 10:27:44 +0200
committerOmar Polo <op@omarpolo.com>2020-07-25 10:27:44 +0200
commit1f5886b440219912a014be764649edfe627daa60 (patch)
tree7e33ffb538ee75c4f2b521c82a3bbc926d89f56f /sam-test.el
parentdd6ad538977f26a853f9b4061fdeb3467c8c00b4 (diff)
downloadsam.el-1f5886b440219912a014be764649edfe627daa60.tar.gz
sam.el-1f5886b440219912a014be764649edfe627daa60.tar.bz2
improved command parsing
* renamed `sam-parse-command' to `sam-parse-line' * `sam-parse-command' takes a command (e.g. "=#") and returns a cons of the string representation of the command ("=#") and the symbol to call (sam-cmd-charoffset). * added a small test for this
Diffstat (limited to 'sam-test.el')
-rw-r--r--sam-test.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/sam-test.el b/sam-test.el
index 1c6fafb..65536a6 100644
--- a/sam-test.el
+++ b/sam-test.el
@@ -6,7 +6,7 @@
(require 'ert)
(require 'sam)
-(ert-deftest sam-parse-command-test ()
+(ert-deftest sam-parse-line-test ()
(dolist (spec '(("3" "p" <- "3p")
("3" "p" <- "3 p")
("34" "p" <- "34\tp")
@@ -17,4 +17,12 @@
(should (string-equal exp-addr address))
(should (string-equal exp-cmd command))))))
+(ert-deftest sam-parse-command-test ()
+ (let ((spec '(("=#" -> "=#" sam-cmd-charoffset))))
+ (cl-loop
+ for (input _ exp-cmd exp-fn) in spec
+ do (cl-destructuring-bind (cmd . fn) (sam-parse-command input)
+ (should (string-equal exp-cmd cmd))
+ (should (string-equal exp-fn fn))))))
+
;; (ert-run-tests-interactively t)