Sha256: 174fcefdc393e5dbcf773cd06d06abb7e1cf681688bc50113e669577c7ff6416

Contents?: true

Size: 871 Bytes

Versions: 15

Compression:

Stored size: 871 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)
{
  const char* foo = "foo";
  Exception ex(rb_eRuntimeError, "%s", "foo");
  ASSERT_EQUAL(foo, ex.what());
}

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rice2-2.2.1 test/test_Exception.cpp
rice2-2.2.0 test/test_Exception.cpp
rice-2.2.0 test/test_Exception.cpp
rice-2.1.3 test/test_Exception.cpp
rice-2.1.2 test/test_Exception.cpp
rice-2.1.1 test/test_Exception.cpp
rice-2.1.0 test/test_Exception.cpp
rice-2.0.0 test/test_Exception.cpp
rice-1.7.0 test/test_Exception.cpp
rice-1.6.3 test/test_Exception.cpp
rice-1.6.2 test/test_Exception.cpp
rice-1.6.1 test/test_Exception.cpp
rice-1.6.0 test/test_Exception.cpp
rice-1.6.0.pre test/test_Exception.cpp
rice-1.5.3 test/test_Exception.cpp