summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/sh-script-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/progmodes/sh-script-tests.el')
-rw-r--r--test/lisp/progmodes/sh-script-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/progmodes/sh-script-tests.el b/test/lisp/progmodes/sh-script-tests.el
index ebd26ab4295..5d01cc1c226 100644
--- a/test/lisp/progmodes/sh-script-tests.el
+++ b/test/lisp/progmodes/sh-script-tests.el
@@ -23,6 +23,7 @@
(require 'sh-script)
(require 'ert)
+(require 'ert-x)
(ert-deftest test-sh-script-indentation ()
(with-temp-buffer
@@ -48,4 +49,24 @@
}
"))))
+(ert-deftest test-indentation ()
+ (ert-test-erts-file (ert-resource-file "sh-indents.erts")))
+
+(defun test-sh-back (string &optional pos)
+ (with-temp-buffer
+ (shell-script-mode)
+ (insert string)
+ (sh-smie--default-backward-token)
+ (= (point) (or pos 1))))
+
+(ert-deftest test-backward-token ()
+ (should (test-sh-back "foo"))
+ (should (test-sh-back "foo.bar"))
+ (should (test-sh-back "foo\\1bar"))
+ (should (test-sh-back "foo\\\nbar"))
+ (should (test-sh-back "foo\\\n\\\n\\\nbar"))
+ (should (test-sh-back "foo"))
+ (should-not (test-sh-back "foo;bar"))
+ (should (test-sh-back "foo#zot")))
+
;;; sh-script-tests.el ends here