emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/lua-mode 1d21a10 259/468: Reorganize test structure


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 1d21a10 259/468: Reorganize test structure
Date: Thu, 5 Aug 2021 04:58:49 -0400 (EDT)

branch: elpa/lua-mode
commit 1d21a101a8c7e839b65fa793afef4149698cf09c
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    Reorganize test structure
    
    - rename test helper to test-helper.el
    
    - rename test-XX.el to XX-test.el to avoid confusion with test-helper
    
    - `load', not `require' test-helper
---
 Makefile                                           | 23 ++++++++++++----------
 ...ltin-font-lock.el => builtin-font-lock-test.el} |  9 +++------
 ...-defun-font-lock.el => defun-font-lock-test.el} |  8 +++-----
 ...test-electric-mode.el => electric-mode-test.el} | 12 +++--------
 test/{test-indentation.el => indentation-test.el}  | 10 ++++------
 ...nd-comments.el => strings-and-comments-test.el} |  8 +++-----
 ...ua-font-lock-test-helpers.el => test-helper.el} |  4 +---
 7 files changed, 30 insertions(+), 44 deletions(-)

diff --git a/Makefile b/Makefile
index 301724a..3702314 100644
--- a/Makefile
+++ b/Makefile
@@ -9,34 +9,37 @@ EMACS?=emacs
 EMACS_BATCH=cask exec $(EMACS) --batch -Q
 
 TESTS=
-TESTS += test/test-defun-font-lock.el
-TESTS += test/test-builtin-font-lock.el
-TESTS += test/test-electric-mode.el
-TESTS += test/test-indentation.el
-TESTS += test/test-strings-and-comments.el
+TESTS += test/defun-font-lock-test.el
+TESTS += test/builtin-font-lock-test.el
+TESTS += test/electric-mode-test.el
+TESTS += test/indentation-test.el
+TESTS += test/strings-and-comments-test.el
 
 default:
        @echo version is $(VERSION)
 
-compile:
-       $(EMACS_BATCH) -f batch-byte-compile lua-mode.el
+%.elc: %.el
+       $(EMACS_BATCH) -f batch-byte-compile $<
+
+compile: lua-mode.elc
+
 
 dist:
        rm -f $(DISTFILE) && \
        git archive --format=zip -o $(DISTFILE) --prefix=lua-mode/ HEAD
 
-.PHONY: test test-compiled test-uncompiled
+.PHONY: test-compiled test-uncompiled
 # check both regular and compiled versions
 test: test-compiled test-uncompiled
 
 test-compiled: compile
        $(EMACS_BATCH) -l test/ert.el \
-               -l lua-mode.elc -l test/lua-font-lock-test-helpers.el \
+               -l lua-mode.elc \
                $(addprefix -l ,$(TESTS)) -f ert-run-tests-batch-and-exit
 
 test-uncompiled:
        $(EMACS_BATCH) -l test/ert.el \
-               -l lua-mode.el -l test/lua-font-lock-test-helpers.el \
+               -l lua-mode.el \
                $(addprefix -l ,$(TESTS)) -f ert-run-tests-batch-and-exit
 
 release:
diff --git a/test/test-builtin-font-lock.el b/test/builtin-font-lock-test.el
similarity index 85%
rename from test/test-builtin-font-lock.el
rename to test/builtin-font-lock-test.el
index 5e3184a..a468b4e 100644
--- a/test/test-builtin-font-lock.el
+++ b/test/builtin-font-lock-test.el
@@ -1,9 +1,6 @@
-(require 'ert)
-(require 'lua-font-lock-test-helpers
-         ;; let's try a bit to help Emacs find the helpers, just in case
-         (concat (file-name-directory (or load-file-name (buffer-file-name)
-                                          default-directory))
-                 "lua-font-lock-test-helpers.el"))
+(load (concat (file-name-directory (or load-file-name (buffer-file-name)
+                                       default-directory))
+              "test-helper.el") nil 'nomessage 'nosuffix)
 
 
 (ert-deftest lua-font-lock-builtins ()
diff --git a/test/test-defun-font-lock.el b/test/defun-font-lock-test.el
similarity index 90%
rename from test/test-defun-font-lock.el
rename to test/defun-font-lock-test.el
index 28072ab..a137e7d 100644
--- a/test/test-defun-font-lock.el
+++ b/test/defun-font-lock-test.el
@@ -1,9 +1,7 @@
 (require 'ert)
-(require 'lua-font-lock-test-helpers
-         ;; let's try a bit to help Emacs find the helpers, just in case
-         (concat (file-name-directory (or load-file-name (buffer-file-name)
-                                          default-directory))
-                 "lua-font-lock-test-helpers.el"))
+(load (concat (file-name-directory (or load-file-name (buffer-file-name)
+                                       default-directory))
+              "test-helper.el") nil 'nomessage 'nosuffix)
 
 
 (ert-deftest lua-font-lock-defuns ()
diff --git a/test/test-electric-mode.el b/test/electric-mode-test.el
similarity index 91%
rename from test/test-electric-mode.el
rename to test/electric-mode-test.el
index b95797e..1e618f0 100644
--- a/test/test-electric-mode.el
+++ b/test/electric-mode-test.el
@@ -1,12 +1,6 @@
-(require 'ert)
-(require 's)
-
-(defmacro with-lua-buffer (&rest body)
-  `(with-temp-buffer
-     (switch-to-buffer (current-buffer))
-     (lua-mode)
-     (font-lock-fontify-buffer)
-     ,@body))
+(load (concat (file-name-directory (or load-file-name (buffer-file-name)
+                                       default-directory))
+              "test-helper.el") nil 'nomessage 'nosuffix)
 
 
 (ert-deftest test-electric-brace ()
diff --git a/test/test-indentation.el b/test/indentation-test.el
similarity index 96%
rename from test/test-indentation.el
rename to test/indentation-test.el
index aefbf53..2ccfe34 100644
--- a/test/test-indentation.el
+++ b/test/indentation-test.el
@@ -1,10 +1,8 @@
 (require 'cl-lib)
-(require 'ert)
-(require 'lua-font-lock-test-helpers
-         ;; let's try a bit to help Emacs find the helpers, just in case
-         (concat (file-name-directory (or load-file-name (buffer-file-name)
-                                          default-directory))
-                 "lua-font-lock-test-helpers.el"))
+(load (concat (file-name-directory (or load-file-name (buffer-file-name)
+                                       default-directory))
+              "test-helper.el") nil 'nomessage 'nosuffix)
+
 
 (ert-deftest lua-indentation-assignment ()
   (should-lua-indent "\
diff --git a/test/test-strings-and-comments.el 
b/test/strings-and-comments-test.el
similarity index 89%
rename from test/test-strings-and-comments.el
rename to test/strings-and-comments-test.el
index 904805a..1cf1f02 100644
--- a/test/test-strings-and-comments.el
+++ b/test/strings-and-comments-test.el
@@ -1,9 +1,7 @@
 (require 'ert)
-(require 'lua-font-lock-test-helpers
-         ;; let's try a bit to help Emacs find the helpers, just in case
-         (concat (file-name-directory (or load-file-name (buffer-file-name)
-                                          default-directory))
-                 "lua-font-lock-test-helpers.el"))
+(load (concat (file-name-directory (or load-file-name (buffer-file-name)
+                                       default-directory))
+              "test-helper.el") nil 'nomessage 'nosuffix)
 
 (defmacro should= (lhs rhs)
   `(should (equal ,lhs ,rhs)))
diff --git a/test/lua-font-lock-test-helpers.el b/test/test-helper.el
similarity index 98%
rename from test/lua-font-lock-test-helpers.el
rename to test/test-helper.el
index 32a44ec..6c1a87e 100644
--- a/test/lua-font-lock-test-helpers.el
+++ b/test/test-helper.el
@@ -1,3 +1,4 @@
+(require 'ert)
 (require 'lua-mode)
 
 (defun get-str-faces (str)
@@ -96,6 +97,3 @@ This is a mere typing/reading aid for lua-mode's font-lock 
tests."
          (indent-tabs-mode nil))
      (should
       (equal strs (lua-get-indented-strs strs)))))
-
-
-(provide 'lua-font-lock-test-helpers)



reply via email to

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