aboutsummaryrefslogtreecommitdiff
path: root/sam-test.el
blob: 1c6fafb02bf55d29d0f2ae05d488dc9660ff91f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
;;; sam-test.el --- sam test suite.  -*- lexical-binding: t -*-

(eval-when-compile
  (require 'cl-lib))

(require 'ert)
(require 'sam)

(ert-deftest sam-parse-command-test ()
  (dolist (spec '(("3" "p"  <- "3p")
                  ("3" "p"  <- "3 p")
                  ("34" "p" <- "34\tp")
                  ("" "b"   <- "b")
                  ("32" ""  <- "32")))
    (cl-destructuring-bind (exp-addr exp-cmd _ cmd) spec
      (cl-destructuring-bind (address . command) (sam-parse-command cmd)
        (should (string-equal exp-addr address))
        (should (string-equal exp-cmd  command))))))

;; (ert-run-tests-interactively t)