aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoakim Verona2013-04-17 21:56:43 +0200
committerJoakim Verona2013-04-17 21:56:43 +0200
commit7ae411e3bef9f3bb49502614067b301944b775bf (patch)
tree2a7ca825644b8c83cd1dbf17f810bc9d3c3fd7f6 /test
parent1083adac63284cf1f81676c6adc801c9ceb283a8 (diff)
parent86dfe9dc6768ae0e932b4a29ce7da5ceb613855a (diff)
downloademacs-7ae411e3bef9f3bb49502614067b301944b775bf.tar.gz
emacs-7ae411e3bef9f3bb49502614067b301944b775bf.zip
upstream
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/python-tests.el87
-rw-r--r--test/automated/ruby-mode-tests.el36
3 files changed, 128 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index bf68984e9e8..7c25ad1a804 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
12013-04-17 Fabián Ezequiel Gallina <fgallina@gnu.org>
2
3 * automated/python-tests.el (python-nav-backward-defun-1)
4 (python-nav-forward-defun-1): New tests.
5
12013-04-09 Masatake YAMATO <yamato@redhat.com> 62013-04-09 Masatake YAMATO <yamato@redhat.com>
2 7
3 * automated/add-log-tests.el: New file. (Bug#14112) 8 * automated/add-log-tests.el: New file. (Bug#14112)
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 1a741b45d81..a7c7aab6464 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -674,6 +674,93 @@ def decoratorFunctionWithArguments(arg1, arg2, arg3):
674 (python-tests-look-at "return wrapped_f") 674 (python-tests-look-at "return wrapped_f")
675 (line-beginning-position)))))) 675 (line-beginning-position))))))
676 676
677(ert-deftest python-nav-backward-defun-1 ()
678 (python-tests-with-temp-buffer
679 "
680class A(object): # A
681
682 def a(self): # a
683 pass
684
685 def b(self): # b
686 pass
687
688 class B(object): # B
689
690 class C(object): # C
691
692 def d(self): # d
693 pass
694
695 # def e(self): # e
696 # pass
697
698 def c(self): # c
699 pass
700
701 # def d(self): # d
702 # pass
703"
704 (goto-char (point-max))
705 (should (= (save-excursion (python-nav-backward-defun))
706 (python-tests-look-at " def c(self): # c" -1)))
707 (should (= (save-excursion (python-nav-backward-defun))
708 (python-tests-look-at " def d(self): # d" -1)))
709 (should (= (save-excursion (python-nav-backward-defun))
710 (python-tests-look-at " class C(object): # C" -1)))
711 (should (= (save-excursion (python-nav-backward-defun))
712 (python-tests-look-at " class B(object): # B" -1)))
713 (should (= (save-excursion (python-nav-backward-defun))
714 (python-tests-look-at " def b(self): # b" -1)))
715 (should (= (save-excursion (python-nav-backward-defun))
716 (python-tests-look-at " def a(self): # a" -1)))
717 (should (= (save-excursion (python-nav-backward-defun))
718 (python-tests-look-at "class A(object): # A" -1)))
719 (should (not (python-nav-backward-defun)))))
720
721(ert-deftest python-nav-forward-defun-1 ()
722 (python-tests-with-temp-buffer
723 "
724class A(object): # A
725
726 def a(self): # a
727 pass
728
729 def b(self): # b
730 pass
731
732 class B(object): # B
733
734 class C(object): # C
735
736 def d(self): # d
737 pass
738
739 # def e(self): # e
740 # pass
741
742 def c(self): # c
743 pass
744
745 # def d(self): # d
746 # pass
747"
748 (goto-char (point-min))
749 (should (= (save-excursion (python-nav-forward-defun))
750 (python-tests-look-at "(object): # A")))
751 (should (= (save-excursion (python-nav-forward-defun))
752 (python-tests-look-at "(self): # a")))
753 (should (= (save-excursion (python-nav-forward-defun))
754 (python-tests-look-at "(self): # b")))
755 (should (= (save-excursion (python-nav-forward-defun))
756 (python-tests-look-at "(object): # B")))
757 (should (= (save-excursion (python-nav-forward-defun))
758 (python-tests-look-at "(object): # C")))
759 (should (= (save-excursion (python-nav-forward-defun))
760 (python-tests-look-at "(self): # d")))
761 (should (= (save-excursion (python-nav-forward-defun))
762 (python-tests-look-at "(self): # c")))
763 (should (not (python-nav-forward-defun)))))
677 764
678(ert-deftest python-nav-beginning-of-statement-1 () 765(ert-deftest python-nav-beginning-of-statement-1 ()
679 (python-tests-with-temp-buffer 766 (python-tests-with-temp-buffer
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index 0ebe6d44e34..23dc45ad509 100644
--- a/test/automated/ruby-mode-tests.el
+++ b/test/automated/ruby-mode-tests.el
@@ -487,6 +487,42 @@ VALUES-PLIST is a list with alternating index and value elements."
487 (ruby-beginning-of-block) 487 (ruby-beginning-of-block)
488 (should (= 1 (line-number-at-pos))))) 488 (should (= 1 (line-number-at-pos)))))
489 489
490(ert-deftest ruby-move-to-block-does-not-fold-case ()
491 (ruby-with-temp-buffer
492 (ruby-test-string
493 "foo do
494 | Module.to_s
495 |end")
496 (end-of-buffer)
497 (let ((case-fold-search t))
498 (ruby-beginning-of-block))
499 (should (= 1 (line-number-at-pos)))))
500
501(ert-deftest ruby-beginning-of-defun-does-not-fold-case ()
502 (ruby-with-temp-buffer
503 (ruby-test-string
504 "class C
505 | def bar
506 | Class.to_s
507 | end
508 |end")
509 (goto-line 4)
510 (let ((case-fold-search t))
511 (beginning-of-defun))
512 (should (= 2 (line-number-at-pos)))))
513
514(ert-deftest ruby-end-of-defun-skips-to-next-line-after-the-method ()
515 (ruby-with-temp-buffer
516 (ruby-test-string
517 "class D
518 | def tee
519 | 'ho hum'
520 | end
521 |end")
522 (goto-line 2)
523 (end-of-defun)
524 (should (= 5 (line-number-at-pos)))))
525
490(provide 'ruby-mode-tests) 526(provide 'ruby-mode-tests)
491 527
492;;; ruby-mode-tests.el ends here 528;;; ruby-mode-tests.el ends here