Add catches_strings test to test throws char * typemap
This commit is contained in:
parent
034e2358f9
commit
4a29229bab
21 changed files with 286 additions and 0 deletions
20
Examples/test-suite/d/catches_strings_runme.1.d
Normal file
20
Examples/test-suite/d/catches_strings_runme.1.d
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module catches_strings_runme;
|
||||
|
||||
import catches_strings.catches_strings;
|
||||
import catches_strings.StringsThrower;
|
||||
import std.algorithm;
|
||||
|
||||
void main() {
|
||||
{
|
||||
bool exception_thrown = false;
|
||||
try {
|
||||
StringsThrower.charstring();
|
||||
} catch (Exception e) {
|
||||
if (!canFind(e.msg, "charstring message"))
|
||||
throw new Exception("incorrect exception message:" ~ e.msg);
|
||||
exception_thrown = true;
|
||||
}
|
||||
if (!exception_thrown)
|
||||
throw new Exception("Should have thrown an exception");
|
||||
}
|
||||
}
|
||||
20
Examples/test-suite/d/catches_strings_runme.2.d
Normal file
20
Examples/test-suite/d/catches_strings_runme.2.d
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module catches_strings_runme;
|
||||
|
||||
import catches_strings.catches_strings;
|
||||
import catches_strings.StringsThrower;
|
||||
import std.algorithm;
|
||||
|
||||
void main() {
|
||||
{
|
||||
bool exception_thrown = false;
|
||||
try {
|
||||
StringsThrower.charstring();
|
||||
} catch (Exception e) {
|
||||
if (!canFind(e.msg, "charstring message"))
|
||||
throw new Exception("incorrect exception message:" ~ e.msg);
|
||||
exception_thrown = true;
|
||||
}
|
||||
if (!exception_thrown)
|
||||
throw new Exception("Should have thrown an exception");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue