summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNeale Swinnerton <neale@isismanor.com>2013-03-15 11:21:58 +0000
committerNeale Swinnerton <neale@isismanor.com>2013-04-03 11:38:15 +0100
commitd19b5b5689e1fea7b6b0f9e3527548471c488212 (patch)
treedacbaf56c5e9a7b6d9e480cffb4158790b57b1bf /test
parent2efff2e3f4c3e26aad3241ecc0757856633d515e (diff)
Enhanced error highlighting, errors in red, warnings in yellow.
Diffstat (limited to 'test')
-rw-r--r--test/nrepl-tests.el78
1 files changed, 67 insertions, 11 deletions
diff --git a/test/nrepl-tests.el b/test/nrepl-tests.el
index 17736a9e..d830f08e 100644
--- a/test/nrepl-tests.el
+++ b/test/nrepl-tests.el
@@ -135,17 +135,73 @@
(let ((nrepl-hide-special-buffers t))
(should (equal (nrepl-server-buffer-name) " *nrepl-server*"))))
-(ert-deftest test-nrepl-extract-error-line ()
- (let ((st "this context, compiling:(/some/test/file.clj:20) ala bala"))
- (should (= (nrepl-extract-error-line st) 20)))
- (let ((st "this context, compiling:(NO_SOURCE_PATH:20) ala bala"))
- (should (= (nrepl-extract-error-line st) 20))))
-
-(ert-deftest test-nrepl-extract-error-filename ()
- (let ((st "this context, compiling:(/some/test/file.clj:20) ala bala"))
- (should (string= (nrepl-extract-error-filename st) "/some/test/file.clj")))
- (let ((st "this context, compiling:(NO_SOURCE_PATH:20) ala bala"))
- (should (string= (nrepl-extract-error-filename st) "NO_SOURCE_PATH"))))
+(ert-deftest test-nrepl-extract-error-info-14 ()
+ (let ((message "CompilerException java.lang.RuntimeException: Unable to resolve symbol: dummy in this context, compiling:(/some/test/file/core.clj:31)"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (string= (nth 0 info) "/some/test/file/core.clj"))
+ (should (= (nth 1 info) 31))
+ (should (= (nth 2 info) 0))
+ (should (equal (nth 3 info) 'nrepl-error-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-error-info-14-no-file ()
+ (let ((message "CompilerException java.lang.RuntimeException: Unable to resolve symbol: dummy in this context, compiling:(NO_SOURCE_PATH:31)"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (equal (nth 0 info) nil))
+ (should (= (nth 1 info) 31))
+ (should (= (nth 2 info) 0))
+ (should (equal (nth 3 info) 'nrepl-error-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-warning-info-14 ()
+ (let ((message "Reflection warning, /some/othertest/file/core.clj:24 - reference to field getCanonicalPath can't be resolved.
+"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (string= (nth 0 info) "/some/othertest/file/core.clj"))
+ (should (= (nth 1 info) 24))
+ (should (= (nth 2 info) 0))
+ (should (equal (nth 3 info) 'nrepl-warning-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-warning-info-14-no-file ()
+ (let ((message "Reflection warning, NO_SOURCE_PATH:24 - reference to field getCanonicalPath can't be resolved.
+"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (equal (nth 0 info) nil))
+ (should (= (nth 1 info) 24))
+ (should (= (nth 2 info) 0))
+ (should (equal (nth 3 info) 'nrepl-warning-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-error-info-15 ()
+ (let ((message "CompilerException java.lang.RuntimeException: Unable to resolve symbol: dummy in this context, compiling:(/some/test/file/core.clj:31:3)"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (string= (nth 0 info) "/some/test/file/core.clj"))
+ (should (= (nth 1 info) 31))
+ (should (= (nth 2 info) 3))
+ (should (equal (nth 3 info) 'nrepl-error-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-error-info-15-no-file ()
+ (let ((message "CompilerException java.lang.RuntimeException: Unable to resolve symbol: dummy in this context, compiling:(NO_SOURCE_PATH:31:3)"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (equal (nth 0 info) nil))
+ (should (= (nth 1 info) 31))
+ (should (= (nth 2 info) 3))
+ (should (equal (nth 3 info) 'nrepl-error-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-warning-info-15 ()
+ (let ((message "Reflection warning, /some/othertest/file/core.clj:24:43 - reference to field getCanonicalPath can't be resolved.
+"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (string= (nth 0 info) "/some/othertest/file/core.clj"))
+ (should (= (nth 1 info) 24))
+ (should (= (nth 2 info) 43))
+ (should (equal (nth 3 info) 'nrepl-warning-highlight-face)))))
+
+(ert-deftest test-nrepl-extract-warning-info-15-no-file ()
+ (let ((message "Reflection warning, NO_SOURCE_PATH:24:43 - reference to field getCanonicalPath can't be resolved.
+"))
+ (let ((info (nrepl-extract-error-info nrepl-compilation-regexp message)))
+ (should (equal (nth 0 info) nil))
+ (should (= (nth 1 info) 24))
+ (should (= (nth 2 info) 43))
+ (should (equal (nth 3 info) 'nrepl-warning-highlight-face)))))
(defmacro nrepl-test-with-two-buffers (buffer-names &rest body)
(lexical-let ((create (lambda (b) (list b `(generate-new-buffer " *temp*")))))