Sha256: 64cc5aea2c91c64bc91eb7b490aa5756b19946a2d40a0b646b2831b4da34ab1e

Contents?: true

Size: 846 Bytes

Versions: 22

Compression:

Stored size: 846 Bytes

Contents

#include "unittest.hpp"
#include "rice/Exception.hpp"
#include "rice/String.hpp"

using namespace Rice;

TESTSUITE(Exception);

SETUP(Exception)
{
  ruby_init();
}

TESTCASE(construct_from_exception_object)
{
  VALUE v = protect(rb_exc_new2, rb_eRuntimeError, "foo");
  Exception ex(v);
  ASSERT_EQUAL(ex.value(), v);
}

TESTCASE(copy_construct)
{
  VALUE v = protect(rb_exc_new2, rb_eRuntimeError, "foo");
  Exception ex1(v);
  Exception ex2(v);
  ASSERT_EQUAL(ex2.value(), v);
}

TESTCASE(construct_from_format_string)
{
  Exception ex(rb_eRuntimeError, "%s", "foo");
  ASSERT_EQUAL(ex.class_of(), Object(rb_eRuntimeError));
}

TESTCASE(message)
{
  Exception ex(rb_eRuntimeError, "%s", "foo");
  ASSERT_EQUAL(String("foo"), ex.message());
}

TESTCASE(what)
{
  Exception ex(rb_eRuntimeError, "%s", "foo");
  ASSERT_EQUAL("foo", ex.what());
}

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
jameskilton-rice-1.2.0 test/test_Exception.cpp
rice-1.5.2 test/test_Exception.cpp
keyme-rice-1.5.1.keyme1 test/test_Exception.cpp
keyme-rice-1.5.1.keyme test/test_Exception.cpp
rice-1.5.1 test/test_Exception.cpp
rice-1.5.0 test/test_Exception.cpp
rice-jdguyot-1.4.3p1 test/test_Exception.cpp
rice-1.4.3 test/test_Exception.cpp
wurlinc-rice-1.4.0.4 test/test_Exception.cpp
wurlinc-rice-1.4.0.1 test/test_Exception.cpp
rice-1.4.2 test/test_Exception.cpp
rice-jdguyot-1.4.0.p1 test/test_Exception.cpp
rice-jdguyot-1.4.0 test/test_Exception.cpp
rice-1.4.0 test/test_Exception.cpp
rice-1.3.2 test/test_Exception.cpp
rice-1.3.1 test/test_Exception.cpp
rice-1.3.0 test/test_Exception.cpp
rice-1.2.0 test/test_Exception.cpp
rice-1.1.0 test/test_Exception.cpp
rice-1.0.0 test/test_Exception.cpp