diff options
| author | Fabián Ezequiel Gallina | 2013-04-17 02:08:20 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2013-04-17 02:08:20 -0300 |
| commit | 083850a6a195c5d536bd4cd344b5917b225597cc (patch) | |
| tree | 8015b635f7d05add5ce355d04a06569e7a63798b /test/automated/python-tests.el | |
| parent | 619ed6e18a4231c9d9c8e50b21eb1e870e7e6853 (diff) | |
| download | emacs-083850a6a195c5d536bd4cd344b5917b225597cc.tar.gz emacs-083850a6a195c5d536bd4cd344b5917b225597cc.zip | |
New defun movement commands.
* lisp/progmodes/python.el (python-nav--syntactically)
(python-nav--forward-defun, python-nav-backward-defun)
(python-nav-forward-defun): New functions.
* test/automated/python-tests.el (python-nav-backward-defun-1)
(python-nav-forward-defun-1): New tests.
Diffstat (limited to 'test/automated/python-tests.el')
| -rw-r--r-- | test/automated/python-tests.el | 87 |
1 files changed, 87 insertions, 0 deletions
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 | " | ||
| 680 | class 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 | " | ||
| 724 | class 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 |