Mercurial > projects > dstress
changeset 155:2c9eb7937bb2
added delegate tests
author | thomask |
---|---|
date | Wed, 01 Dec 2004 07:23:29 +0000 |
parents | 505eb6178186 |
children | 00e9b628b851 |
files | nocompile/delegate_02.d nocompile/delegate_03.d nocompile/delegate_05.d nocompile/delegate_07.d nocompile/delegate_08.d nocompile/delegate_09.d nocompile/delegate_10.d nocompile/delegate_11.d run/delegate_04.d run/delegate_06.d run/delegate_12.d |
diffstat | 11 files changed, 232 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_02.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,17 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can't be initialized with non-member functions + +module dstress.nocompile.delegate_02; + +int test(){ + return 3; +} + +int main(){ + int delegate() dl; + dl = &test; + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_03.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,23 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can't be initialized with static member functions or +// non-member functions + +module dstress.nocompile.delegate_03; + +struct MyStruct{ + static int test(){ + return 3; + } +} + +int main(){ + int delegate() dl; + + MyStruct s; + dl = &s.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_05.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,23 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can't be initialized with static member functions or +// non-member functions + +module dstress.nocompile.delegate_05; + +class MyClass{ + static int test(){ + return 3; + } +} + +int main(){ + int delegate() dl; + + MyClass c; + dl = &c.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_07.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,20 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can only be initialized with non-static member functions + +module dstress.nocompile.delegate_07; + +struct MyStruct{ + int test; +} + +int main(){ + int delegate() dl; + + MyStruct s; + dl = &s.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_08.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,20 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can only be initialized with non-static member functions + +module dstress.nocompile.delegate_08; + +class MyClass{ + int test; +} + +int main(){ + int delegate() dl; + + MyClass c; + dl = &c.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_09.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,20 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can only be initialized with non-static member functions + +module dstress.nocompile.delegate_09; + +enum MyEnum{ + test +} + +int main(){ + int delegate() dl; + + MyEnum e; + dl = &e.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_10.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,21 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can only be initialized with non-static member functions + +module dstress.nocompile.delegate_10; + +union MyUnion{ + int test; + byte b; +} + +int main(){ + int delegate() dl; + + MyUnion u; + dl = &u.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/delegate_11.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,23 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +// delegates can only be initialized with non-static member functions + +module dstress.nocompile.delegate_11; + +union MyUnion{ + static int test(){ + return b; + } + byte b; +} + +int main(){ + int delegate() dl; + + MyUnion u; + dl = &u.test; + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/delegate_04.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,21 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +module dstress.run.delegate_04; + +struct MyStruct{ + int test(){ + return 3; + } +} + +int main(){ + int delegate() dl; + + MyStruct s; + dl = &s.test; + assert(dl()==3); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/delegate_06.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,21 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +module dstress.run.delegate_06; + +class MyClass{ + int test(){ + return 3; + } +} + +int main(){ + int delegate() dl; + + MyClass c = new MyClass(); + dl = &c.test; + assert(dl()==3); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/delegate_12.d Wed Dec 01 07:23:29 2004 +0000 @@ -0,0 +1,23 @@ +// $HeaderURL$ +// $Date$ +// $Author$ + +module dstress.run.delegate_12; + +union MyUnion{ + int test(){ + return b; + } + byte b; +} + +int main(){ + int delegate() dl; + + MyUnion u; + u.b = 3; + dl = &u.test; + assert(dl()==3); + + return 0; +}