[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)
- [elpa] externals/beardbolt 8cf5134dbe 098/323: add pony lang support (WIP), (continued)
- [elpa] externals/beardbolt 8cf5134dbe 098/323: add pony lang support (WIP), ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 480e0371bf 094/323: Update documentation and add autoload, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cd424d2556 087/323: Fix broken disassemble spelling, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 971d6cfeae 093/323: Various fixes and cleanups, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a5614c56d7 113/323: Merge branch 'pony', ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b348482d7f 091/323: Switch to imgur for image links, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d187b8b189 125/323: Optimize guide display when many line blocks found, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt de28f7903a 232/323: Merge branch 'fix-kill-buffer-error' into 'master', ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3fe322e573 242/323: Merge branch 'improve-auto-compilation' into 'master', ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 194e7ea9dc 253/323: Dumb rename rmsbolt->bearbold, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3870c30bbd 257/323: Move test/*test.el to beardbolt-tests.el,
ELPA Syncer <=
- [elpa] externals/beardbolt 98f766bdfc 270/323: Add a README.md, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 28fc329861 262/323: Rework bb-compile a bit, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f491a6adb2 278/323: Rework to use write-region, use a little less memory, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2633e20e66 274/323: * beardbolt.el (bb--reachable-p): Rework for small speed gain., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 60fa7a3c05 280/323: Force asm output to be of a certain format, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b2dc0eb81d 284/323: Make beardbolt-disassemble work again, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 730ea84796 290/323: bb-compile-delay can be nil, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2c798336b8 292/323: Tweak README.md, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c05a0be490 297/323: Add useful beardbolt-preserve-library-functions, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 26c0b918e4 301/323: Tweak README.md again, ELPA Syncer, 2023/03/09