summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile7
-rw-r--r--tests/012/ifa.tl15
-rw-r--r--tests/common.tl13
4 files changed, 30 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index d57de311..605b65c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2015-07-23 Kaz Kylheku <kaz@kylheku.com>
+ Split off test macros from ifa.tl into common file.
+
+ * Makefile (TESTS_OUT): Don't use find to hunt down tests;
+ but rather wildcard. This way common.tl is not mistakenly
+ identified as an independent test file.
+
+ * tests/012/ifa.tl: Removed test code, placed in new file
+ which is loaded.
+
+ * tests/common.tl: New file.
+
+2015-07-23 Kaz Kylheku <kaz@kylheku.com>
+
Fixes for building in separate dir.
* Makefile (CFLAGS): Search for mpi header in $(top_srcdir).
diff --git a/Makefile b/Makefile
index cbb1219d..ace97a2d 100644
--- a/Makefile
+++ b/Makefile
@@ -242,10 +242,9 @@ endif
TESTS_TMP := txr.test.out
TESTS_OUT := $(addprefix tst/,\
- $(patsubst %.tl,%.out,\
- $(patsubst %.txr,%.out,\
- $(shell find -H tests \
- \( -name '*.txr' -o -name '*.tl' \) | sort))))
+ $(patsubst %.tl,%.out,\
+ $(patsubst %.txr,%.out,\
+ $(wildcard $(addprefix tests/*/*.,txr tl)))))
TESTS_OK := $(TESTS_OUT:.out=.ok)
.PHONY: tests
diff --git a/tests/012/ifa.tl b/tests/012/ifa.tl
index ae283abc..64fc6793 100644
--- a/tests/012/ifa.tl
+++ b/tests/012/ifa.tl
@@ -1,17 +1,4 @@
-(defmacro error-to-sym (expr)
- ^(catch ,expr
- (error (cond) :error)))
-
-;; test framework for ifa uses ifa!
-(defmacro test (:env env expr expected)
- (catch
- (let ((expr-expn (macroexpand expr env)))
- ^(ifa (not (equal (error-to-sym ,expr-expn) ',expected))
- (error "test case ~s failed: produced ~s; expected ~s"
- ',expr it ',expected)))
- (error (exc)
- (unless (eq expected :error)
- (error "test case ~s failed to expand: expected is ~s" expr expected)))))
+(load "../common")
;; "it" is (+ 2 2)
(test (ifa (> (+ 2 2) 0) (* it 2))
diff --git a/tests/common.tl b/tests/common.tl
new file mode 100644
index 00000000..f4ad7351
--- /dev/null
+++ b/tests/common.tl
@@ -0,0 +1,13 @@
+(defmacro error-to-sym (expr)
+ ^(catch ,expr
+ (error (cond) :error)))
+
+(defmacro test (:env env expr expected)
+ (catch
+ (let ((expr-expn (macroexpand expr env)))
+ ^(ifa (not (equal (error-to-sym ,expr-expn) ',expected))
+ (error "test case ~s failed: produced ~s; expected ~s"
+ ',expr it ',expected)))
+ (error (exc)
+ (unless (eq expected :error)
+ (error "test case ~s failed to expand: expected is ~s" expr expected)))))