blob: a7ef847b35638d8d4bd6ba3e231ad95ad8bb412b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <cassert>
#include <sstream>
#include <stdexcept>
#include <libhello/version.hxx>
#include <libhello/hello.hxx>
int main ()
{
using namespace std;
using namespace hello;
// 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"));
}
}
|