mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-10 00:43:13 +01:00
[svn r138] forgot the latest tests
This commit is contained in:
18
tangotests/p.d
Normal file
18
tangotests/p.d
Normal 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
22
tangotests/q.d
Normal 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
27
tangotests/r.d
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user