[svn r138] forgot the latest tests

This commit is contained in:
Tomas Lindquist Olsen
2008-01-14 05:32:24 +01:00
parent 4505b9b006
commit 1f5760b5af
3 changed files with 67 additions and 0 deletions

18
tangotests/p.d Normal file
View File

@@ -0,0 +1,18 @@
extern(C) int printf(char*, ...);
int main(char[][] args)
{
printf("getint\n");
int i = getint();
printf("assert true\n");
assert(i == 1234);
printf("assert false\n");
assert(i != 1234);
printf("return\n");
return 0;
}
int getint()
{
return 1234;
}

22
tangotests/q.d Normal file
View File

@@ -0,0 +1,22 @@
class E : Exception
{
this(char[] msg)
{
super(msg);
}
char[] toString()
{
return super.toString();
}
}
extern(C) int printf(char*, ...);
void main()
{
auto e = new E("hello world");
auto msg = e.toString();
printf("message should be: '%.*s'\n", msg.length, msg.ptr);
throw e;
}

27
tangotests/r.d Normal file
View File

@@ -0,0 +1,27 @@
extern(C) int printf(char*, ...);
class C
{
void dump()
{
printf("C dumped\n");
}
}
void heap()
{
auto c = new C;
c.dump();
}
void stack()
{
scope c = new C;
c.dump();
}
void main()
{
heap();
stack();
}