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

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

[elpa] externals/beardbolt 3870c30bbd 257/323: Move test/*test.el to bea


From: ELPA Syncer
Subject: [elpa] externals/beardbolt 3870c30bbd 257/323: Move test/*test.el to beardbolt-tests.el
Date: Thu, 9 Mar 2023 10:58:36 -0500 (EST)

branch: externals/beardbolt
commit 3870c30bbd484a3160618a0cabc5f61909f1f0b1
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Move test/*test.el to beardbolt-tests.el
    
    Makes for easier maintainability, and there aren't really that many
    tests.
    
    * beardbolt-tests.el: new file
    * test/beardbolt-split-test.el: Remove
    * test/beardbolt-test.el: Remove
---
 test/beardbolt-split-test.el => beardbolt-tests.el | 103 ++++++++++++++++++-
 test/beardbolt-test.el                             | 111 ---------------------
 2 files changed, 99 insertions(+), 115 deletions(-)

diff --git a/test/beardbolt-split-test.el b/beardbolt-tests.el
similarity index 56%
rename from test/beardbolt-split-test.el
rename to beardbolt-tests.el
index 3907c6e3c1..eb10afa355 100644
--- a/test/beardbolt-split-test.el
+++ b/beardbolt-tests.el
@@ -1,11 +1,106 @@
-;;; beardbolt-split-test.el --- Tests for beardbolt-split -*- lexical-binding: 
t; -*-
+;;; beardbolt-test.el --- Tests for beardbolt  -*- lexical-binding: t; -*-
 
 ;;; Commentary:
 ;; Tests for beardbolt
 
 ;;; Code:
 
-(require 'beardbolt-split)
+(require 'ert)
+(require 'beardbolt)
+
+(defun test-asm-preprocessor (pre post)
+  "Tests the asm preprocessor on the current buffer."
+  (insert-file-contents pre)
+  (should
+   (string=
+    (string-trim
+     (mapconcat 'identity
+                (beardbolt--process-asm-lines (current-buffer)
+                                            (split-string (buffer-string) "\n" 
t))
+                "\n"))
+    (with-temp-buffer
+      (insert-file-contents post)
+      (string-trim
+       (buffer-string))))))
+
+;;;; Filtration tests
+
+(ert-deftest filter-tests-all-c ()
+  "Test if assembly filteration in c is working."
+  (with-temp-buffer
+    (setq-local beardbolt-disassemble nil)
+    (setq-local beardbolt-filter-comment-only t)
+    (setq-local beardbolt-filter-directives t)
+    (setq-local beardbolt-filter-labels t)
+    (test-asm-preprocessor "test/beardbolt-c-pre1.s" 
"test/beardbolt-c-post1.s")))
+(ert-deftest filter-tests-none-c ()
+  "Test if assembly filteration in c is working."
+  (with-temp-buffer
+    (setq-local beardbolt-disassemble nil)
+    (setq-local beardbolt-filter-comment-only nil)
+    (setq-local beardbolt-filter-directives nil)
+    (setq-local beardbolt-filter-labels nil)
+    (test-asm-preprocessor "test/beardbolt-c-pre1.s" 
"test/beardbolt-c-post2.s")))
+(ert-deftest filter-tests-dir-c ()
+  "Test if assembly filteration in c is working."
+  (with-temp-buffer
+    (setq-local beardbolt-disassemble nil)
+    (setq-local beardbolt-filter-comment-only nil)
+    (setq-local beardbolt-filter-directives t)
+    (setq-local beardbolt-filter-labels nil)
+    (test-asm-preprocessor "test/beardbolt-c-pre1.s" 
"test/beardbolt-c-post3.s")))
+(ert-deftest filter-tests-weak-ref-c ()
+  "Test if assembly filteration in c is working."
+  (with-temp-buffer
+    (setq-local beardbolt-disassemble nil)
+    (setq-local beardbolt-filter-comment-only nil)
+    (setq-local beardbolt-filter-directives t)
+    (setq-local beardbolt-filter-labels t)
+    (test-asm-preprocessor "test/beardbolt-c-pre2.s" 
"test/beardbolt-c-post4.s")))
+
+;;;; Demangler tests
+
+(ert-deftest demangler-test-disabled ()
+  (with-temp-buffer
+    (setq-local beardbolt-demangle nil)
+    (should
+     (string-empty-p
+      (beardbolt--demangle-command
+       ""
+       (make-beardbolt-lang :demangler nil)
+       (current-buffer))))))
+
+(ert-deftest demangler-test-invalid-demangler ()
+  (with-temp-buffer
+    (setq-local beardbolt-demangle t)
+    (should
+     (string-empty-p
+      (beardbolt--demangle-command
+       ""
+       (make-beardbolt-lang :demangler nil)
+       (current-buffer))))))
+
+(ert-deftest demangler-test-not-path ()
+  (with-temp-buffer
+    (setq-local beardbolt-demangle t)
+    (should
+     (string-empty-p
+      (beardbolt--demangle-command
+       ""
+       (make-beardbolt-lang :demangler "nonsense-binary-name-not-on-path")
+       (current-buffer))))))
+
+(ert-deftest demangler-test-valid-demangler ()
+  ;; Assumes test is on the path!
+  (with-temp-buffer
+    (setq-local beardbolt-demangle t)
+    (should
+     (string-match-p
+      (regexp-opt '("test"))
+      (beardbolt--demangle-command
+       ""
+       (make-beardbolt-lang :demangler "test")
+       (current-buffer))))))
 
 (ert-deftest test-split-single ()
   "Test split single function"
@@ -62,6 +157,6 @@
             "/usr/bin/c++   -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB 
-DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -Isrc/googletest/include -I../common -Icommon 
-Icommon/protobuf -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtCore -isystem 
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtGui   -Werror=retu [...]
            "/usr/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB 
-DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -Isrc/googletest/include -I../common -Icommon 
-Icommon/protobuf -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtCore -isystem 
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtGui -Werror=return-lo [...]
 
-(provide 'beardbolt-split-test)
 
-;;; beardbolt-split-test.el ends here
+;;; beardbolt-test.el ends here
+(provide 'beardbolt-test)
diff --git a/test/beardbolt-test.el b/test/beardbolt-test.el
deleted file mode 100644
index d47a30204b..0000000000
--- a/test/beardbolt-test.el
+++ /dev/null
@@ -1,111 +0,0 @@
-;;; beardbolt-test.el --- Tests for beardbolt  -*- lexical-binding: t; -*-
-
-;;; Commentary:
-;; Tests for beardbolt
-
-;;; Code:
-
-(require 'el-mock nil t)
-(require 'beardbolt)
-
-(ert-deftest sanity-check-ert ()
-  "Check if ERT is working. :)"
-  (should t))
-
-(defun test-asm-preprocessor (pre post)
-  "Tests the asm preprocessor on the current buffer."
-  (insert-file-contents pre)
-  (should
-   (string=
-    (string-trim
-     (mapconcat 'identity
-                (beardbolt--process-asm-lines (current-buffer)
-                                            (split-string (buffer-string) "\n" 
t))
-                "\n"))
-    (with-temp-buffer
-      (insert-file-contents post)
-      (string-trim
-       (buffer-string))))))
-
-;;;; Filtration tests
-
-(ert-deftest filter-tests-all-c ()
-  "Test if assembly filteration in c is working."
-  (with-temp-buffer
-    (setq-local beardbolt-disassemble nil)
-    (setq-local beardbolt-filter-comment-only t)
-    (setq-local beardbolt-filter-directives t)
-    (setq-local beardbolt-filter-labels t)
-    (test-asm-preprocessor "test/beardbolt-c-pre1.s" 
"test/beardbolt-c-post1.s")))
-(ert-deftest filter-tests-none-c ()
-  "Test if assembly filteration in c is working."
-  (with-temp-buffer
-    (setq-local beardbolt-disassemble nil)
-    (setq-local beardbolt-filter-comment-only nil)
-    (setq-local beardbolt-filter-directives nil)
-    (setq-local beardbolt-filter-labels nil)
-    (test-asm-preprocessor "test/beardbolt-c-pre1.s" 
"test/beardbolt-c-post2.s")))
-(ert-deftest filter-tests-dir-c ()
-  "Test if assembly filteration in c is working."
-  (with-temp-buffer
-    (setq-local beardbolt-disassemble nil)
-    (setq-local beardbolt-filter-comment-only nil)
-    (setq-local beardbolt-filter-directives t)
-    (setq-local beardbolt-filter-labels nil)
-    (test-asm-preprocessor "test/beardbolt-c-pre1.s" 
"test/beardbolt-c-post3.s")))
-(ert-deftest filter-tests-weak-ref-c ()
-  "Test if assembly filteration in c is working."
-  (with-temp-buffer
-    (setq-local beardbolt-disassemble nil)
-    (setq-local beardbolt-filter-comment-only nil)
-    (setq-local beardbolt-filter-directives t)
-    (setq-local beardbolt-filter-labels t)
-    (test-asm-preprocessor "test/beardbolt-c-pre2.s" 
"test/beardbolt-c-post4.s")))
-
-;;;; Demangler tests
-
-(ert-deftest demangler-test-disabled ()
-  (with-temp-buffer
-    (setq-local beardbolt-demangle nil)
-    (should
-     (string-empty-p
-      (beardbolt--demangle-command
-       ""
-       (make-beardbolt-lang :demangler nil)
-       (current-buffer))))))
-
-(ert-deftest demangler-test-invalid-demangler ()
-  (with-temp-buffer
-    (setq-local beardbolt-demangle t)
-    (should
-     (string-empty-p
-      (beardbolt--demangle-command
-       ""
-       (make-beardbolt-lang :demangler nil)
-       (current-buffer))))))
-
-(ert-deftest demangler-test-not-path ()
-  (with-temp-buffer
-    (setq-local beardbolt-demangle t)
-    (should
-     (string-empty-p
-      (beardbolt--demangle-command
-       ""
-       (make-beardbolt-lang :demangler "nonsense-binary-name-not-on-path")
-       (current-buffer))))))
-
-(ert-deftest demangler-test-valid-demangler ()
-  ;; Assumes test is on the path!
-  (with-temp-buffer
-    (setq-local beardbolt-demangle t)
-    (should
-     (string-match-p
-      (regexp-opt '("test"))
-      (beardbolt--demangle-command
-       ""
-       (make-beardbolt-lang :demangler "test")
-       (current-buffer))))))
-
-
-;;; beardbolt-test.el ends here
-(provide 'beardbolt-test)



reply via email to

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