emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7f287b7: Incorporate syntax-tests in lisp-tests.


From: Eli Zaretskii
Subject: [Emacs-diffs] master 7f287b7: Incorporate syntax-tests in lisp-tests.
Date: Sat, 24 Sep 2016 10:21:03 +0000 (UTC)

branch: master
commit 7f287b7f780849ca32cddaf69dac83a435f92300
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Incorporate syntax-tests in lisp-tests.
    
    * test/lisp/emacs-lisp/lisp-tests.el: Add tests from
    test/lisp/legacy/syntax-tests.el.
    * test/lisp/legacy/syntax-tests.el: File deleted.
---
 test/lisp/emacs-lisp/lisp-tests.el |   71 +++++++++++++++++++++++++-
 test/lisp/legacy/syntax-tests.el   |   97 ------------------------------------
 2 files changed, 69 insertions(+), 99 deletions(-)

diff --git a/test/lisp/emacs-lisp/lisp-tests.el 
b/test/lisp/emacs-lisp/lisp-tests.el
index d83f4a0..2dadae9 100644
--- a/test/lisp/emacs-lisp/lisp-tests.el
+++ b/test/lisp/emacs-lisp/lisp-tests.el
@@ -4,6 +4,7 @@
 
 ;; Author: Aaron S. Hawley <address@hidden>
 ;; Author: Stefan Monnier <address@hidden>
+;; Author: Daniel Colascione <address@hidden>
 ;; Keywords: internal
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
@@ -27,6 +28,7 @@
 
 (require 'ert)
 (require 'python)
+(require 'cl-lib)
 
 (ert-deftest lisp-forward-sexp-1-empty-parens ()
   "Test basics of \\[forward-sexp]."
@@ -233,8 +235,73 @@
 (ert-deftest core-elisp-tests-3-backquote ()
   (should (eq 3 (eval ``,,'(+ 1 2)))))
 
-(provide 'core-elisp-tests)
-;;; core-elisp-tests.el ends here
+;; Test up-list and backward-up-list.
+(defun lisp-run-up-list-test (fn data start instructions)
+  (cl-labels ((posof (thing)
+                (and (symbolp thing)
+                     (= (length (symbol-name thing)) 1)
+                     (- (aref (symbol-name thing) 0) ?a -1))))
+    (with-temp-buffer
+      (set-syntax-table (make-syntax-table))
+      ;; Use a syntax table in which single quote is a string
+      ;; character so that we can embed the test data in a lisp string
+      ;; literal.
+      (modify-syntax-entry ?\' "\"")
+      (insert data)
+      (goto-char (posof start))
+      (dolist (instruction instructions)
+        (cond ((posof instruction)
+               (funcall fn)
+               (should (eql (point) (posof instruction))))
+              ((symbolp instruction)
+               (should-error (funcall fn)
+                             :type instruction))
+              (t (cl-assert nil nil "unknown ins")))))))
+
+(defmacro define-lisp-up-list-test (name fn data start &rest expected)
+  `(ert-deftest ,name ()
+     (lisp-run-up-list-test ,fn ,data ',start ',expected)))
+
+(define-lisp-up-list-test up-list-basic
+  (lambda () (up-list))
+  (or "(1 1 (1 1) 1 (1 1) 1)")
+  ;;   abcdefghijklmnopqrstuv
+  i k v scan-error)
+
+(define-lisp-up-list-test up-list-with-forward-sexp-function
+  (lambda ()
+    (let ((forward-sexp-function
+           (lambda (&optional arg)
+             (let ((forward-sexp-function nil))
+               (forward-sexp arg)))))
+      (up-list)))
+  (or "(1 1 (1 1) 1 (1 1) 1)")
+  ;;   abcdefghijklmnopqrstuv
+  i k v scan-error)
+
+(define-lisp-up-list-test up-list-out-of-string
+  (lambda () (up-list 1 t))
+  (or "1 (1 '2 2 (2 2 2' 1) 1")
+  ;;   abcdefghijklmnopqrstuvwxy
+  o r u scan-error)
+
+(define-lisp-up-list-test up-list-cross-string
+  (lambda () (up-list 1 t))
+  (or "(1 '2 ( 2' 1 '2 ) 2' 1)")
+  ;;   abcdefghijklmnopqrstuvwxy
+  i r u x scan-error)
+
+(define-lisp-up-list-test up-list-no-cross-string
+  (lambda () (up-list 1 t t))
+  (or "(1 '2 ( 2' 1 '2 ) 2' 1)")
+  ;;   abcdefghijklmnopqrstuvwxy
+  i k x scan-error)
+
+(define-lisp-up-list-test backward-up-list-basic
+  (lambda () (backward-up-list))
+  (or "(1 1 (1 1) 1 (1 1) 1)")
+  ;;   abcdefghijklmnopqrstuv
+  i f a scan-error)
 
 (provide 'lisp-tests)
 ;;; lisp-tests.el ends here
diff --git a/test/lisp/legacy/syntax-tests.el b/test/lisp/legacy/syntax-tests.el
deleted file mode 100644
index d4af80e..0000000
--- a/test/lisp/legacy/syntax-tests.el
+++ /dev/null
@@ -1,97 +0,0 @@
-;;; syntax-tests.el --- Testing syntax rules and basic movement -*- 
lexical-binding: t -*-
-
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
-
-;; Author: Daniel Colascione <address@hidden>
-;; Keywords:
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;
-
-;;; Code:
-(require 'ert)
-(require 'cl-lib)
-
-(defun run-up-list-test (fn data start instructions)
-  (cl-labels ((posof (thing)
-                (and (symbolp thing)
-                     (= (length (symbol-name thing)) 1)
-                     (- (aref (symbol-name thing) 0) ?a -1))))
-    (with-temp-buffer
-      (set-syntax-table (make-syntax-table))
-      ;; Use a syntax table in which single quote is a string
-      ;; character so that we can embed the test data in a lisp string
-      ;; literal.
-      (modify-syntax-entry ?\' "\"")
-      (insert data)
-      (goto-char (posof start))
-      (dolist (instruction instructions)
-        (cond ((posof instruction)
-               (funcall fn)
-               (should (eql (point) (posof instruction))))
-              ((symbolp instruction)
-               (should-error (funcall fn)
-                             :type instruction))
-              (t (cl-assert nil nil "unknown ins")))))))
-
-(defmacro define-up-list-test (name fn data start &rest expected)
-  `(ert-deftest ,name ()
-     (run-up-list-test ,fn ,data ',start ',expected)))
-
-(define-up-list-test up-list-basic
-  (lambda () (up-list))
-  (or "(1 1 (1 1) 1 (1 1) 1)")
-  ;;   abcdefghijklmnopqrstuv
-  i k v scan-error)
-
-(define-up-list-test up-list-with-forward-sexp-function
-  (lambda ()
-    (let ((forward-sexp-function
-           (lambda (&optional arg)
-             (let ((forward-sexp-function nil))
-               (forward-sexp arg)))))
-      (up-list)))
-  (or "(1 1 (1 1) 1 (1 1) 1)")
-  ;;   abcdefghijklmnopqrstuv
-  i k v scan-error)
-
-(define-up-list-test up-list-out-of-string
-  (lambda () (up-list 1 t))
-  (or "1 (1 '2 2 (2 2 2' 1) 1")
-  ;;   abcdefghijklmnopqrstuvwxy
-  o r u scan-error)
-
-(define-up-list-test up-list-cross-string
-  (lambda () (up-list 1 t))
-  (or "(1 '2 ( 2' 1 '2 ) 2' 1)")
-  ;;   abcdefghijklmnopqrstuvwxy
-  i r u x scan-error)
-
-(define-up-list-test up-list-no-cross-string
-  (lambda () (up-list 1 t t))
-  (or "(1 '2 ( 2' 1 '2 ) 2' 1)")
-  ;;   abcdefghijklmnopqrstuvwxy
-  i k x scan-error)
-
-(define-up-list-test backward-up-list-basic
-  (lambda () (backward-up-list))
-  (or "(1 1 (1 1) 1 (1 1) 1)")
-  ;;   abcdefghijklmnopqrstuv
-  i f a scan-error)
-
-(provide 'syntax-tests)
-;;; syntax-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]