Add support for throwing wstring exceptions
Throw an ApplicationException for std::wstring and wchar_t * strings
This commit is contained in:
parent
0fbd6cc364
commit
79a9389355
4 changed files with 106 additions and 7 deletions
|
|
@ -105,6 +105,24 @@ public class runme
|
|||
check_equal(e.Message, "throwing test_throw");
|
||||
}
|
||||
|
||||
try {
|
||||
li_std_wstring.test_throw_jp();
|
||||
} catch (Exception e) {
|
||||
check_equal(e.Message, "JP: 日本語");
|
||||
}
|
||||
|
||||
try {
|
||||
li_std_wstring.test_throw_ref_jp();
|
||||
} catch (Exception e) {
|
||||
check_equal(e.Message, "JP: 日本語");
|
||||
}
|
||||
|
||||
try {
|
||||
li_std_wstring.test_throw_wchar_t_ptr();
|
||||
} catch (Exception e) {
|
||||
check_equal(e.Message, "JP: 日本語");
|
||||
}
|
||||
|
||||
x = "abc\0def";
|
||||
// Unlike other languages, embedded NULL in std::string not supported
|
||||
// check_equal(li_std_wstring.test_value(x), x);
|
||||
|
|
|
|||
|
|
@ -103,9 +103,23 @@ bool test_equal_ru(const std::wstring &s) {
|
|||
return test_equal(RU_WSTRING, s);
|
||||
}
|
||||
|
||||
void test_throw() TESTCASE_THROW1(std::wstring){
|
||||
void test_throw() TESTCASE_THROW1(std::wstring) {
|
||||
static std::wstring x = L"throwing test_throw";
|
||||
|
||||
throw x;
|
||||
}
|
||||
|
||||
void test_throw_wchar_t_ptr() TESTCASE_THROW1(std::wstring) {
|
||||
static std::wstring x = JP_WSTRING;
|
||||
throw x;
|
||||
}
|
||||
|
||||
void test_throw_jp() TESTCASE_THROW1(std::wstring) {
|
||||
static std::wstring x = JP_WSTRING;
|
||||
throw x;
|
||||
}
|
||||
|
||||
void test_throw_ref_jp() TESTCASE_THROW1(const std::wstring&) {
|
||||
static std::wstring x = JP_WSTRING;
|
||||
throw x;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue