copy/tests/basics/driver.cxx

36 lines
532 B
C++
Raw Permalink Normal View History

2024-09-01 23:43:44 +00:00
#include <sstream>
#include <stdexcept>
#include <libcopy-test/version.hxx>
#include <libcopy-test/copy-test.hxx>
#undef NDEBUG
#include <cassert>
int main ()
{
using namespace std;
using namespace copy_test;
// 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"));
}
}