Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktasia committed Jan 21, 2016
1 parent eb4b3dc commit e85b1b6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/data/proj2-elisp/fake2.el
@@ -0,0 +1,15 @@
;; a totally fake file for tests

(defun when-var-is-in-sig (my-arg2)
(let* ((my-arg 22))
(if (> my-arg2 my-arg)
""
(something-else my-arg2))))

(defun when-var-is-in-let ()
(let* ((my-arg 11)
(my-arg2 22))
(if (> my-arg2 my-arg)
""
(when-var-is-in-sig my-arg2))))
;; end of file
28 changes: 28 additions & 0 deletions test/dumb-jump-test.el
Expand Up @@ -175,6 +175,34 @@
(should (string= (plist-get result :path) go-js-file))))
(dumb-jump-go)))))

(ert-deftest dumb-jump-go-var-let-test ()
(let ((el-file (f-join test-data-dir-elisp "fake2.el")))
(with-current-buffer (find-file-noselect el-file t)
(goto-char (point-min))
(forward-line 13)
(forward-char 33)
(noflet ((dumb-jump-handle-results (a b c d e)
(should (= (length a) 2))
(funcall this-fn a b c d e))
(dumb-jump-result-follow (result)
(should (string= (plist-get result :path) el-file))
(should (= (plist-get result :line) 11))))
(dumb-jump-go)))))

(ert-deftest dumb-jump-go-var-arg-test ()
(let ((el-file (f-join test-data-dir-elisp "fake2.el")))
(with-current-buffer (find-file-noselect el-file t)
(goto-char (point-min))
(forward-line 4)
(forward-char 12)
(noflet ((dumb-jump-handle-results (a b c d e)
(should (= (length a) 2))
(funcall this-fn a b c d e))
(dumb-jump-result-follow (result)
(should (string= (plist-get result :path) el-file))
(should (= (plist-get result :line) 3))))
(dumb-jump-go)))))

(ert-deftest dumb-jump-back-test ()
(let ((js-file (f-join test-data-dir-proj1 "src" "js" "fake2.js"))
(go-js-file (f-join test-data-dir-proj1 "src" "js" "fake.js")))
Expand Down

0 comments on commit e85b1b6

Please sign in to comment.