aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoakim Verona2013-03-07 00:03:57 +0100
committerJoakim Verona2013-03-07 00:03:57 +0100
commit2dcf541ff79077c00b5ca257a005a163affb3c9a (patch)
treec57b1582ce2d0ca7c894d36b45a7ff41613d8e05 /test
parent79157e99328fb1d835985dfa89fc2a2fa427d077 (diff)
parentab89e9f9a594c30ce4c04e6d502bee3beaefe908 (diff)
downloademacs-2dcf541ff79077c00b5ca257a005a163affb3c9a.tar.gz
emacs-2dcf541ff79077c00b5ca257a005a163affb3c9a.zip
auto upstream
Diffstat (limited to 'test')
-rw-r--r--test/automated/ruby-mode-tests.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index c67f92e6ed9..81bae187218 100644
--- a/test/automated/ruby-mode-tests.el
+++ b/test/automated/ruby-mode-tests.el
@@ -47,17 +47,16 @@ The whitespace before and including \"|\" on each line is removed."
47(defun ruby-test-string (s &rest args) 47(defun ruby-test-string (s &rest args)
48 (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args)) 48 (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args))
49 49
50(defun ruby-assert-state (content &rest values-plist) 50(defun ruby-assert-state (content index value &optional point)
51 "Assert syntax state values at the end of CONTENT. 51 "Assert syntax state values at the end of CONTENT.
52 52
53VALUES-PLIST is a list with alternating index and value elements." 53VALUES-PLIST is a list with alternating index and value elements."
54 (ruby-with-temp-buffer content 54 (ruby-with-temp-buffer content
55 (when point (goto-char point))
55 (syntax-propertize (point)) 56 (syntax-propertize (point))
56 (while values-plist 57 (should (eq (nth index
57 (should (eq (nth (car values-plist) 58 (parse-partial-sexp (point-min) (point)))
58 (parse-partial-sexp (point-min) (point))) 59 value))))
59 (cadr values-plist)))
60 (setq values-plist (cddr values-plist)))))
61 60
62(defun ruby-assert-face (content pos face) 61(defun ruby-assert-face (content pos face)
63 (ruby-with-temp-buffer content 62 (ruby-with-temp-buffer content
@@ -104,6 +103,12 @@ VALUES-PLIST is a list with alternating index and value elements."
104 (ruby-should-indent "a = %w[abc\n def]\n " 0) 103 (ruby-should-indent "a = %w[abc\n def]\n " 0)
105 (ruby-should-indent "a = \"abc\n def\"\n " 0)) 104 (ruby-should-indent "a = \"abc\n def\"\n " 0))
106 105
106(ert-deftest ruby-regexp-doest-start-in-string ()
107 (ruby-assert-state "'(/', /\d+/" 3 nil))
108
109(ert-deftest ruby-regexp-starts-after-string ()
110 (ruby-assert-state "'(/', /\d+/" 3 ?/ 8))
111
107(ert-deftest ruby-indent-simple () 112(ert-deftest ruby-indent-simple ()
108 (ruby-should-indent-buffer 113 (ruby-should-indent-buffer
109 "if foo 114 "if foo