summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-05 12:48:27 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-05 12:48:27 +0300
commit17e7584dfbabf01ae14c364a808ff2d8ef90c0f7 (patch)
tree87e85bc2c0ba7ec30d03a0a94d37855e4b6d847c
parent9646f4bb0cee026bdf9dbe4bf318f24e60697bae (diff)
Add tests
-rw-r--r--build/bootstrap.build1
-rw-r--r--buildfile6
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/build/.gitignore1
-rw-r--r--tests/build/bootstrap.build5
-rw-r--r--tests/build/root.build14
-rw-r--r--tests/buildfile1
-rw-r--r--tests/test/buildfile4
-rw-r--r--tests/test/driver.cxx9
-rw-r--r--tests/test/test.out1
10 files changed, 42 insertions, 1 deletions
diff --git a/build/bootstrap.build b/build/bootstrap.build
index bc4a8b1..1941f1a 100644
--- a/build/bootstrap.build
+++ b/build/bootstrap.build
@@ -3,4 +3,5 @@ project = libprint
using version
using config
using dist
+using test
using install
diff --git a/buildfile b/buildfile
index a85a1dc..5dd2544 100644
--- a/buildfile
+++ b/buildfile
@@ -1,4 +1,8 @@
-./: libprint/ doc{version} file{manifest}
+./: libprint/ tests/ doc{version} file{manifest}
doc{version}: file{manifest} # Generated by the version module.
doc{version}: dist = true
+
+# Don't install tests.
+#
+dir{tests/}: install = false
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/tests/build/.gitignore b/tests/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/tests/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build
new file mode 100644
index 0000000..2c2de24
--- /dev/null
+++ b/tests/build/bootstrap.build
@@ -0,0 +1,5 @@
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/tests/build/root.build b/tests/build/root.build
new file mode 100644
index 0000000..a2ee38a
--- /dev/null
+++ b/tests/build/root.build
@@ -0,0 +1,14 @@
+cxx.std = 11
+
+using cxx
+
+hxx{*}: extension = hxx
+cxx{*}: extension = cxx
+
+# Every exe{} in this subproject is by default a test.
+#
+exe{*}: test = true
+
+# Specify the test target for cross-testing.
+#
+test.target = $cxx.target
diff --git a/tests/buildfile b/tests/buildfile
new file mode 100644
index 0000000..1a8bcc9
--- /dev/null
+++ b/tests/buildfile
@@ -0,0 +1 @@
+./: test/
diff --git a/tests/test/buildfile b/tests/test/buildfile
new file mode 100644
index 0000000..c5bfff4
--- /dev/null
+++ b/tests/test/buildfile
@@ -0,0 +1,4 @@
+import libs = libprint%lib{print}
+
+exe{driver}: cxx{driver} $libs
+exe{driver}: test.output = test.out
diff --git a/tests/test/driver.cxx b/tests/test/driver.cxx
new file mode 100644
index 0000000..27f491d
--- /dev/null
+++ b/tests/test/driver.cxx
@@ -0,0 +1,9 @@
+// file: tests/test/driver.cxx -*- C++ -*-
+
+#include <libprint/print.hxx>
+
+int
+main ()
+{
+ print ("Hello, World!");
+}
diff --git a/tests/test/test.out b/tests/test/test.out
new file mode 100644
index 0000000..8ab686e
--- /dev/null
+++ b/tests/test/test.out
@@ -0,0 +1 @@
+Hello, World!