Skip to content

Commit 39101a6

Browse files
committed
Merge pull request #994 from gracjan/pr-ret-tab-backtab
Add RET, TAB and BACKTAB tests
2 parents 3650a8e + 5c64758 commit 39101a6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/haskell-indentation-tests.el

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,4 +757,26 @@ function = abc
757757
def
758758
xyz"
759759
((3 0) 0 7))
760+
761+
762+
(ert-deftest haskell-indentation-ret-indents ()
763+
(switch-to-buffer (get-buffer-create "source.hs"))
764+
(haskell-mode)
765+
(insert "main = do")
766+
(execute-kbd-macro (kbd "<RET>"))
767+
(should (equal 2 (count-lines (point-min) (point))))
768+
(should (equal 2 (- (point) (line-beginning-position)))))
769+
770+
(ert-deftest haskell-indentation-tab-and-backtab ()
771+
(switch-to-buffer (get-buffer-create "source.hs"))
772+
(haskell-mode)
773+
(insert "main = do\n lala\n ")
774+
(execute-kbd-macro (kbd "TAB"))
775+
(should (equal 4 (count-lines (point-min) (point))))
776+
(should (equal 4 (- (point) (line-beginning-position))))
777+
(execute-kbd-macro (kbd "<backtab>"))
778+
(should (equal 4 (count-lines (point-min) (point))))
779+
(should (equal 2 (- (point) (line-beginning-position)))))
780+
781+
760782
;;; haskell-indentation-tests.el ends here

0 commit comments

Comments
 (0)