Skip to content

Commit

Permalink
Add some tests for regex on method extract
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurnn committed May 5, 2016
1 parent 2edf7d4 commit 54c32c7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/minitest-unit-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,35 @@
(stub file-relative-name => "foo.rb")
(mock (minitest--run-command "bundle exec bin/rails test foo.rb" "foo.rb"))
(minitest--file-command)))

(ert-deftest test-minitest-test-extract-str-with-method ()
(with-temp-buffer
(insert "def test_hello\nend")
(goto-char (point-max))
(minitest--extract-str)
(should (equal (match-string 2) "hello"))))

(ert-deftest test-minitest-test-extract-str-with-block ()
(with-temp-buffer
(insert "test \"hello\" do\nend")
(goto-char (point-max))
(minitest--extract-str)
(should (equal (match-string 2) "hello")))
(with-temp-buffer
(insert "test \"foo\" do\nend\ntest \'bar\' do\nend")
(goto-char (point-max))
(minitest--extract-str)
(should (equal (match-string 2) "bar")))
(with-temp-buffer
(insert "test \'foo\' do\nend\ntest \"bar\" do\nend")
(goto-char (point-max))
(minitest--extract-str)
(should (equal (match-string 2) "bar"))))

;; TODO
;;(ert-deftest test-minitest-test-extract-str-with-block-and-method ()
;; (with-temp-buffer
;; (insert "test \"foo\" do\nend\ndef test_bar\nend")
;; (goto-char (point-max))
;; (minitest--extract-str)
;; (should (equal (match-string 2) "bar"))))

0 comments on commit 54c32c7

Please sign in to comment.