diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-04 14:29:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-04 14:29:05 +0200 |
commit | 49261d3c921a16bffd491555d3a41ea1e5410d13 (patch) | |
tree | f0081f7a03da5226f60782d9731156cceb7ac9fb /libhello/tests | |
parent | cb647d3e1affe6b1ebd8a31b1ad5f7a76cde63ab (diff) |
Regenerate libhello using bdep-new
Diffstat (limited to 'libhello/tests')
-rw-r--r-- | libhello/tests/.gitignore | 7 | ||||
-rw-r--r-- | libhello/tests/basics/buildfile | 3 | ||||
-rw-r--r-- | libhello/tests/basics/driver.cxx | 33 | ||||
-rw-r--r-- | libhello/tests/build/.gitignore | 2 | ||||
-rw-r--r-- | libhello/tests/build/bootstrap.build | 4 | ||||
-rw-r--r-- | libhello/tests/build/root.build | 6 | ||||
-rw-r--r-- | libhello/tests/buildfile | 2 | ||||
-rw-r--r-- | libhello/tests/test/buildfile | 4 | ||||
-rw-r--r-- | libhello/tests/test/driver.cxx | 11 | ||||
-rw-r--r-- | libhello/tests/test/test.out | 1 |
10 files changed, 52 insertions, 21 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..1f0a479 --- /dev/null +++ b/libhello/tests/basics/driver.cxx @@ -0,0 +1,33 @@ +#include <cassert> +#include <sstream> +#include <stdexcept> + +#include <libhello/version.hxx> +#include <libhello/hello.hxx> + +using namespace std; +using namespace hello; + +int main () +{ + // Basics. + // + { + ostringstream o; + say_hello (o, "World"); + assert (o.str () == "Hello, World!\n"); + } + + // Empty name. + // + try + { + ostringstream o; + say_hello (o, ""); + assert (false); + } + catch (const invalid_argument& e) + { + assert (e.what () == string ("empty name")); + } +} 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 38937f0..0000000 --- a/libhello/tests/test/driver.cxx +++ /dev/null @@ -1,11 +0,0 @@ -// file: tests/test/driver.cxx -*- C++ -*- - -#include <libhello/hello.hxx> - -int -main () -{ - using hello::say; - - say ("World"); -} diff --git a/libhello/tests/test/test.out b/libhello/tests/test/test.out deleted file mode 100644 index 8ab686e..0000000 --- a/libhello/tests/test/test.out +++ /dev/null @@ -1 +0,0 @@ -Hello, World! |