summaryrefslogtreecommitdiff
path: root/libhello/tests/basics/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-04 14:29:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-04 14:29:05 +0200
commit49261d3c921a16bffd491555d3a41ea1e5410d13 (patch)
treef0081f7a03da5226f60782d9731156cceb7ac9fb /libhello/tests/basics/driver.cxx
parentcb647d3e1affe6b1ebd8a31b1ad5f7a76cde63ab (diff)
Regenerate libhello using bdep-new
Diffstat (limited to 'libhello/tests/basics/driver.cxx')
-rw-r--r--libhello/tests/basics/driver.cxx33
1 files changed, 33 insertions, 0 deletions
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"));
+ }
+}