[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104177: * test/automated/occur-tests
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104177: * test/automated/occur-tests.el: Move from test/occur-testsuite.el. |
Date: |
Tue, 10 May 2011 03:21:32 +0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104177
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2011-05-10 03:21:32 +0400
message:
* test/automated/occur-tests.el: Move from test/occur-testsuite.el.
Convert to ERT.
renamed:
test/occur-testsuite.el => test/automated/occur-tests.el
modified:
test/ChangeLog
test/automated/occur-tests.el
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2011-05-09 01:22:05 +0000
+++ b/test/ChangeLog 2011-05-09 23:21:32 +0000
@@ -1,3 +1,8 @@
+2011-05-09 Juri Linkov <address@hidden>
+
+ * automated/occur-tests.el: Move from test/occur-testsuite.el.
+ Convert to ERT.
+
2011-05-09 Chong Yidong <address@hidden>
* automated/compile-tests.el: New file.
=== renamed file 'test/occur-testsuite.el' => 'test/automated/occur-tests.el'
--- a/test/occur-testsuite.el 2011-01-25 04:08:28 +0000
+++ b/test/automated/occur-tests.el 2011-05-09 23:21:32 +0000
@@ -1,4 +1,4 @@
-;;; occur-testsuite.el --- Test suite for occur.
+;;; occur-tests.el --- Test suite for occur.
;; Copyright (C) 2010-2011 Free Software Foundation, Inc.
@@ -20,12 +20,10 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;; Commentary:
-
-;; Type M-x test-occur RET to test the functionality of `occur'.
-
;;; Code:
+(require 'ert)
+
(defconst occur-tests
'(
;; * Test one-line matches (at bob, eob, bol, eol).
@@ -37,7 +35,7 @@
xex
fx
" "\
-5 matches for \"x\" in buffer: *temp*
+5 matches for \"x\" in buffer: *temp*<2>
1:xa
3:cx
4:xd
@@ -54,7 +52,7 @@
a
a
" "\
-2 matches for \"a^Ja\" in buffer: *temp*
+2 matches for \"a^Ja\" in buffer: *temp*<2>
1:a
:a
3:a
@@ -70,7 +68,7 @@
a
b
" "\
-2 matches for \"a^Jb\" in buffer: *temp*
+2 matches for \"a^Jb\" in buffer: *temp*<2>
1:a
:b
4:a
@@ -84,7 +82,7 @@
a
" "\
-2 matches for \"a^J\" in buffer: *temp*
+2 matches for \"a^J\" in buffer: *temp*<2>
1:a
:
4:a
@@ -99,7 +97,7 @@
ex
fx
" "\
-2 matches for \"x^J.x^J\" in buffer: *temp*
+2 matches for \"x^J.x^J\" in buffer: *temp*<2>
1:ax
:bx
:c
@@ -118,7 +116,7 @@
g
hx
" "\
-3 matches for \"x\" in buffer: *temp*
+3 matches for \"x\" in buffer: *temp*<2>
1:ax
:b
-------
@@ -138,7 +136,7 @@
ex
f
" "\
-2 matches for \"x\" in buffer: *temp*
+2 matches for \"x\" in buffer: *temp*<2>
:a
2:bx
:c
@@ -161,7 +159,7 @@
j
kx
" "\
-5 matches for \"x\" in buffer: *temp*
+5 matches for \"x\" in buffer: *temp*<2>
1:ax
2:bx
:c
@@ -186,7 +184,7 @@
h
i
" "\
-2 matches for \"x\" in buffer: *temp*
+2 matches for \"x\" in buffer: *temp*<2>
:a
:b
3:cx
@@ -209,7 +207,7 @@
h
" "\
-2 matches for \"x\" in buffer: *temp*
+2 matches for \"x\" in buffer: *temp*<2>
:
:b
3:cx
@@ -234,7 +232,7 @@
jx
kx
" "\
-3 matches for \"x^J.x\" in buffer: *temp*
+3 matches for \"x^J.x\" in buffer: *temp*<2>
1:ax
:bx
:c
@@ -258,7 +256,7 @@
gx
hx
" "\
-2 matches for \"x^J.x\" in buffer: *temp*
+2 matches for \"x^J.x\" in buffer: *temp*<2>
1:ax
:bx
:c
@@ -281,7 +279,7 @@
h
ix
" "\
-3 matches for \"x\" in buffer: *temp*
+3 matches for \"x\" in buffer: *temp*<2>
:a
2:bx
-------
@@ -304,7 +302,7 @@
gx
h
" "\
-3 matches for \"x\" in buffer: *temp*
+3 matches for \"x\" in buffer: *temp*<2>
:a
2:bx
:c
@@ -319,29 +317,26 @@
Each element has the format:
\(REGEXP NLINES INPUT-BUFFER-STRING OUTPUT-BUFFER-STRING).")
-(defun test-occur ()
- (interactive)
- (let ((count 1)
- failed
- (occur-hook nil))
+(defun occur-test-case (test)
+ (let ((regexp (nth 0 test))
+ (nlines (nth 1 test))
+ (input-buffer-string (nth 2 test))
+ (output-buffer-string (nth 3 test)))
+ (save-window-excursion
+ (with-temp-buffer
+ (insert input-buffer-string)
+ (occur regexp nlines)
+ (equal output-buffer-string
+ (with-current-buffer "*Occur*"
+ (buffer-string)))))))
+
+(ert-deftest occur-tests ()
+ "Test the functionality of `occur'.
+The test data is in the `occur-tests' constant."
+ (let ((occur-hook nil))
(dolist (test occur-tests)
- (let ((regexp (nth 0 test))
- (nlines (nth 1 test))
- (input-buffer-string (nth 2 test))
- (output-buffer-string (nth 3 test)))
- (save-excursion
- (with-temp-buffer
- (insert input-buffer-string)
- (occur regexp nlines)
- (unless (equal output-buffer-string
- (with-current-buffer "*Occur*"
- (buffer-string)))
- (setq failed (cons count failed))))))
- (setq count (1+ count)))
- (if failed
- (message "FAILED TESTS: %S" (reverse failed))
- (message "SUCCESS"))))
-
-(provide 'occur-testsuite)
-
-;;; occur-testsuite.el ends here
+ (should (occur-test-case test)))))
+
+(provide 'occur-tests)
+
+;;; occur-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104177: * test/automated/occur-tests.el: Move from test/occur-testsuite.el.,
Juri Linkov <=