diff options
| author | Glenn Morris | 2011-10-15 13:56:02 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-10-15 13:56:02 -0700 |
| commit | 21fedf28e5c59fd17e846f4b8abcbb223ae5ed90 (patch) | |
| tree | d8fdb448080fcba1b45fdae2ec617aff499bd023 | |
| parent | c235b55508afa9a27d0c21768df7e13fffa7288e (diff) | |
| download | emacs-21fedf28e5c59fd17e846f4b8abcbb223ae5ed90.tar.gz emacs-21fedf28e5c59fd17e846f4b8abcbb223ae5ed90.zip | |
* test/automated/f90.el: New file.
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/automated/f90.el | 158 |
2 files changed, 162 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 6ab148358d9..ea6d90b534c 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2011-10-15 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * automated/f90.el: New file. | ||
| 4 | |||
| 1 | 2011-09-27 Ulf Jasper <ulf.jasper@web.de> | 5 | 2011-09-27 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 6 | ||
| 3 | * automated/newsticker-tests.el: Move newsticker-testsuite.el | 7 | * automated/newsticker-tests.el: Move newsticker-testsuite.el |
diff --git a/test/automated/f90.el b/test/automated/f90.el new file mode 100644 index 00000000000..5d75d5cd0fb --- /dev/null +++ b/test/automated/f90.el | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | ;;; f90.el --- tests for progmodes/f90.el | ||
| 2 | |||
| 3 | ;; Copyright (C) 2011 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Glenn Morris <rgm@gnu.org> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; This file does not have "test" in the name, because it lives under | ||
| 25 | ;; a test/ directory, so that would be superfluous. | ||
| 26 | |||
| 27 | ;;; Code: | ||
| 28 | |||
| 29 | (require 'ert) | ||
| 30 | (require 'f90) | ||
| 31 | |||
| 32 | (defconst f90-test-indent "\ | ||
| 33 | !! Comment before code. | ||
| 34 | !!! Comments before code. | ||
| 35 | #preprocessor before code | ||
| 36 | |||
| 37 | program progname | ||
| 38 | |||
| 39 | implicit none | ||
| 40 | |||
| 41 | integer :: i | ||
| 42 | |||
| 43 | !! Comment. | ||
| 44 | |||
| 45 | do i = 1, 10 | ||
| 46 | |||
| 47 | #preprocessor | ||
| 48 | |||
| 49 | !! Comment. | ||
| 50 | if ( i % 2 == 0 ) then | ||
| 51 | !! Comment. | ||
| 52 | cycle | ||
| 53 | else | ||
| 54 | write(*,*) i | ||
| 55 | end if | ||
| 56 | end do | ||
| 57 | |||
| 58 | !!! Comment. | ||
| 59 | |||
| 60 | end program progname | ||
| 61 | " | ||
| 62 | "Test string for F90 indentation.") | ||
| 63 | |||
| 64 | (ert-deftest f90-test-indent () | ||
| 65 | "Test F90 indentation." | ||
| 66 | (with-temp-buffer | ||
| 67 | (f90-mode) | ||
| 68 | (insert f90-test-indent) | ||
| 69 | (indent-rigidly (point-min) (point-max) -999) | ||
| 70 | (f90-indent-region (point-min) (point-max)) | ||
| 71 | (should (string-equal (buffer-string) f90-test-indent)))) | ||
| 72 | |||
| 73 | (ert-deftest f90-test-bug3729 () | ||
| 74 | "Test for http://debbugs.gnu.org/3729 ." | ||
| 75 | :expected-result :failed | ||
| 76 | (with-temp-buffer | ||
| 77 | (f90-mode) | ||
| 78 | (insert "!! Comment | ||
| 79 | |||
| 80 | include \"file.f90\" | ||
| 81 | |||
| 82 | subroutine test (x) | ||
| 83 | real x | ||
| 84 | x = x+1. | ||
| 85 | return | ||
| 86 | end subroutine test") | ||
| 87 | (goto-char (point-min)) | ||
| 88 | (forward-line 2) | ||
| 89 | (f90-indent-subprogram) | ||
| 90 | (should (= 0 (current-indentation))))) | ||
| 91 | |||
| 92 | (ert-deftest f90-test-bug3730 () | ||
| 93 | "Test for http://debbugs.gnu.org/3730 ." | ||
| 94 | (with-temp-buffer | ||
| 95 | (f90-mode) | ||
| 96 | (insert "a" ) | ||
| 97 | (move-to-column 68 t) | ||
| 98 | (insert "(/ x /)") | ||
| 99 | (f90-do-auto-fill) | ||
| 100 | (beginning-of-line) | ||
| 101 | (skip-chars-forward "[ \t]") | ||
| 102 | (should (equal "&(/" (buffer-substring (point) (+ 3 (point))))))) | ||
| 103 | |||
| 104 | ;; TODO bug#5593 | ||
| 105 | |||
| 106 | (ert-deftest f90-test-bug8691 () | ||
| 107 | "Test for http://debbugs.gnu.org/8691 ." | ||
| 108 | (with-temp-buffer | ||
| 109 | (f90-mode) | ||
| 110 | (insert "module modname | ||
| 111 | type, bind(c) :: type1 | ||
| 112 | integer :: part1 | ||
| 113 | end type type1 | ||
| 114 | end module modname") | ||
| 115 | (f90-indent-subprogram) | ||
| 116 | (forward-line -1) | ||
| 117 | (should (= 2 (current-indentation))))) | ||
| 118 | |||
| 119 | ;; TODO bug#8812 | ||
| 120 | |||
| 121 | (ert-deftest f90-test-bug8820 () | ||
| 122 | "Test for http://debbugs.gnu.org/8820 ." | ||
| 123 | (with-temp-buffer | ||
| 124 | (f90-mode) | ||
| 125 | (should (eq (char-syntax ?%) (string-to-char "."))))) | ||
| 126 | |||
| 127 | (ert-deftest f90-test-bug9553a () | ||
| 128 | "Test for http://debbugs.gnu.org/9553 ." | ||
| 129 | (with-temp-buffer | ||
| 130 | (f90-mode) | ||
| 131 | (insert "!!!") | ||
| 132 | (dotimes (_i 20) (insert " aaaa")) | ||
| 133 | (f90-do-auto-fill) | ||
| 134 | (beginning-of-line) | ||
| 135 | ;; This gives a more informative failure than looking-at. | ||
| 136 | (should (equal "!!! a" (buffer-substring (point) (+ 5 (point))))))) | ||
| 137 | |||
| 138 | (ert-deftest f90-test-bug9553b () | ||
| 139 | "Test for http://debbugs.gnu.org/9553 ." | ||
| 140 | (with-temp-buffer | ||
| 141 | (f90-mode) | ||
| 142 | (insert "!!!") | ||
| 143 | (dotimes (_i 13) (insert " aaaa")) | ||
| 144 | (insert "a, aaaa") | ||
| 145 | (f90-do-auto-fill) | ||
| 146 | (beginning-of-line) | ||
| 147 | (should (equal "!!! a" (buffer-substring (point) (+ 5 (point))))))) | ||
| 148 | |||
| 149 | (ert-deftest f90-test-bug9690 () | ||
| 150 | "Test for http://debbugs.gnu.org/9690 ." | ||
| 151 | (with-temp-buffer | ||
| 152 | (f90-mode) | ||
| 153 | (insert "#include \"foo.h\"") | ||
| 154 | (f90-indent-line) | ||
| 155 | (should (= 0 (current-indentation))))) | ||
| 156 | |||
| 157 | |||
| 158 | ;;; f90.el ends here | ||