summaryrefslogtreecommitdiff
path: root/libhello/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libhello/tests')
-rw-r--r--libhello/tests/.gitignore7
-rw-r--r--libhello/tests/basics/buildfile3
-rw-r--r--libhello/tests/basics/driver.cxx33
-rw-r--r--libhello/tests/build/.gitignore2
-rw-r--r--libhello/tests/build/bootstrap.build4
-rw-r--r--libhello/tests/build/root.build6
-rw-r--r--libhello/tests/buildfile2
-rw-r--r--libhello/tests/test/buildfile4
-rw-r--r--libhello/tests/test/driver.cxx14
-rw-r--r--libhello/tests/test/test.out3
10 files changed, 52 insertions, 26 deletions
diff --git a/libhello/tests/.gitignore b/libhello/tests/.gitignore
index e54525b..662178d 100644
--- a/libhello/tests/.gitignore
+++ b/libhello/tests/.gitignore
@@ -1 +1,8 @@
+# Test executables.
+#
driver
+
+# Testscript output directories (can be symlinks).
+#
+test
+test-*
diff --git a/libhello/tests/basics/buildfile b/libhello/tests/basics/buildfile
new file mode 100644
index 0000000..a436a8c
--- /dev/null
+++ b/libhello/tests/basics/buildfile
@@ -0,0 +1,3 @@
+import libs = libhello%lib{hello}
+
+exe{driver}: {hxx ixx txx cxx}{*} $libs
diff --git a/libhello/tests/basics/driver.cxx b/libhello/tests/basics/driver.cxx
new file mode 100644
index 0000000..2cef70b
--- /dev/null
+++ b/libhello/tests/basics/driver.cxx
@@ -0,0 +1,33 @@
+#include <cassert>
+#include <sstream>
+
+#include <libhello/version.hxx>
+#include <libhello/hello.hxx>
+
+using namespace std;
+using namespace hello;
+
+int main ()
+{
+ // Basics.
+ //
+ {
+ ostringstream o;
+ say_hello_formatted (o, "Hi, World!");
+ assert (o.str () == "Hi, World!\n");
+ }
+
+ {
+ ostringstream o;
+ say_hello (o, "World");
+ assert (o.str () == "Hello, World!\n");
+ }
+
+ // Volume.
+ //
+ {
+ ostringstream o;
+ say_hello (o, "World", format::volume::loud);
+ assert (o.str () == "HELLO, World!\n");
+ }
+}
diff --git a/libhello/tests/build/.gitignore b/libhello/tests/build/.gitignore
index 225c27f..4a730a3 100644
--- a/libhello/tests/build/.gitignore
+++ b/libhello/tests/build/.gitignore
@@ -1 +1,3 @@
config.build
+root/
+bootstrap/
diff --git a/libhello/tests/build/bootstrap.build b/libhello/tests/build/bootstrap.build
index 2c2de24..a07b5ea 100644
--- a/libhello/tests/build/bootstrap.build
+++ b/libhello/tests/build/bootstrap.build
@@ -1,5 +1,5 @@
-project = # Unnamed subproject.
+project = # Unnamed tests subproject.
using config
-using dist
using test
+using dist
diff --git a/libhello/tests/build/root.build b/libhello/tests/build/root.build
index a2ee38a..a67b2fe 100644
--- a/libhello/tests/build/root.build
+++ b/libhello/tests/build/root.build
@@ -1,14 +1,16 @@
-cxx.std = 11
+cxx.std = latest
using cxx
hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
cxx{*}: extension = cxx
# Every exe{} in this subproject is by default a test.
#
exe{*}: test = true
-# Specify the test target for cross-testing.
+# The test target for cross-testing (running tests under Wine, etc).
#
test.target = $cxx.target
diff --git a/libhello/tests/buildfile b/libhello/tests/buildfile
index 1a8bcc9..aeeab15 100644
--- a/libhello/tests/buildfile
+++ b/libhello/tests/buildfile
@@ -1 +1 @@
-./: test/
+./: {*/ -build/}
diff --git a/libhello/tests/test/buildfile b/libhello/tests/test/buildfile
deleted file mode 100644
index 2ff528a..0000000
--- a/libhello/tests/test/buildfile
+++ /dev/null
@@ -1,4 +0,0 @@
-import libs = libhello%lib{hello}
-
-exe{driver}: cxx{driver} $libs
-exe{driver}: file{test.out}: test.stdout = true
diff --git a/libhello/tests/test/driver.cxx b/libhello/tests/test/driver.cxx
deleted file mode 100644
index 1c08bca..0000000
--- a/libhello/tests/test/driver.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-// file: tests/test/driver.cxx -*- C++ -*-
-
-#include <libhello/hello.hxx>
-#include <libformat/format.hxx> // volume
-
-int
-main ()
-{
- using namespace hello;
-
- say ("World");
- say ("World", format::volume::loud);
- say_formatted ("Hi, World!");
-}
diff --git a/libhello/tests/test/test.out b/libhello/tests/test/test.out
deleted file mode 100644
index a9ec19f..0000000
--- a/libhello/tests/test/test.out
+++ /dev/null
@@ -1,3 +0,0 @@
-Hello, World!
-HELLO, World!
-Hi, World!