diff options
Diffstat (limited to 'libformat/tests/basics/driver.cxx')
-rw-r--r-- | libformat/tests/basics/driver.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libformat/tests/basics/driver.cxx b/libformat/tests/basics/driver.cxx index 03faea7..dbc9358 100644 --- a/libformat/tests/basics/driver.cxx +++ b/libformat/tests/basics/driver.cxx @@ -1,4 +1,5 @@ #include <cassert> +#include <stdexcept> #include <libformat/version.hxx> #include <libformat/format.hxx> @@ -8,7 +9,33 @@ using namespace format; int main () { + // Basics. + // assert (format_hello ("Hello", "World", volume::quiet) == "hello, World!"); assert (format_hello ("Hello", "World", volume::normal) == "Hello, World!"); assert (format_hello ("Hello", "World", volume::loud) == "HELLO, World!"); + + // Empty greeting. + // + try + { + format_hello ("", "World"); + assert (false); + } + catch (const invalid_argument& e) + { + assert (e.what () == string ("empty greeting")); + } + + // Empty name. + // + try + { + format_hello ("Hello", ""); + assert (false); + } + catch (const invalid_argument& e) + { + assert (e.what () == string ("empty name")); + } } |