X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.test.cc;h=d3900627f5f4a0122c769ea6a5fef677db0931bb;hb=17d44437f7fb8ee68a96ed55fc327c746c161142;hp=7421921aa1e2c6199e227dca679e351412999146;hpb=96d3a2a43b4e6d7693a136a3adeb099440f19068;p=senf.git diff --git a/Utils/Exception.test.cc b/Utils/Exception.test.cc index 7421921..d390062 100644 --- a/Utils/Exception.test.cc +++ b/Utils/Exception.test.cc @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -29,14 +29,31 @@ // Custom includes #include "Exception.hh" -#include +#include "../Utils/auto_unit_test.hh" #include +#include +#include #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// BOOST_AUTO_UNIT_TEST(errnoException) -{} +{ + try { + try { + throw senf::SystemException("::open()", ENOENT) << "\nmore"; + } + catch(senf::Exception & e) { + e << "\nx=" << 1 << boost::format("\ny=%d") % 2; + throw; + } + } + catch (senf::SystemException & e) { + BOOST_CHECK_EQUAL( e.errorNumber(), ENOENT ); + BOOST_CHECK_EQUAL( e.errorString(), "No such file or directory" ); + BOOST_CHECK_EQUAL( e.what(), "[No such file or directory] ::open()\nmore\nx=1\ny=2" ); + } +} ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_