Skip to content

Commit

Permalink
Dwarf EH: add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Dec 27, 2015
1 parent fc9edc3 commit 5c7d81a
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions test/runnable/eh.d
Expand Up @@ -755,6 +755,73 @@ void test12989()

/****************************************************/

int bar10(int c)
{
if (c <= 0xFFFF)
{
L3:
return 3;
}
throw new Exception("msg");
goto L3;
}

void test10()
{
int x;
try
{
bar10(0x110000);
}
catch (Exception e)
{
printf("caught\n");
x = 1;
}
assert(x == 1);
printf("test10 success\n");
}

/****************************************************/

class ParseException : Exception
{
@safe pure nothrow this( string msg )
{
super( msg );
}
}

class OverflowException : Exception
{
@safe pure nothrow this( string msg )
{
super( msg );
}
}

void test11()
{
int x;
try
{
printf("test11()\n");
throw new ParseException("msg");
}
catch( OverflowException e )
{
printf( "catch OverflowException\n" );
}
catch( ParseException e )
{
printf( "catch ParseException: %.*s\n", cast(int) e.msg.length, e.msg.ptr );
x = 1;
}
assert(x == 1);
}

/****************************************************/

int main()
{
printf("start\n");
Expand All @@ -776,6 +843,8 @@ int main()
test9();
test10964();
test12989();
test10();
test11();

printf("finish\n");
return 0;
Expand Down

0 comments on commit 5c7d81a

Please sign in to comment.