diff options
author | Miguel de Icaza <miguel@gnome.org> | 2005-11-08 06:38:47 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2005-11-08 06:38:47 +0300 |
commit | 98e0e653f6ec7058d6a3e42cf9caabfa0ab6657e (patch) | |
tree | c536361226c7f6f88299e449d8c22bb4c13e8fb8 /mcs/tests/test-469.cs | |
parent | 76764bcb764a47ae509f24973a34d4c1115ba9c0 (diff) |
Add
svn path=/trunk/mcs/; revision=52681
Diffstat (limited to 'mcs/tests/test-469.cs')
-rw-r--r-- | mcs/tests/test-469.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mcs/tests/test-469.cs b/mcs/tests/test-469.cs new file mode 100644 index 00000000000..9e22abaa273 --- /dev/null +++ b/mcs/tests/test-469.cs @@ -0,0 +1,39 @@ +// +// Do not extend this test +// +// This test copes with the case where a parameter was already captured +// and a second anonymous method on the same scope captured a parameter +// +using System; + +delegate void Del (int n); + +class Lambda { + + static int v; + + static void f (int va) + { + v = va; + } + + static Del[] Make2 (int x) { + return new Del[] { + delegate (int a) { f(x += a); }, + delegate (int b) { f(x += b); } + }; + } + + static int Main () { + Del[] d = Make2(10); + d[0](10); + if (v != 20) + return 1; + + d[1](11); + if (v != 31) + return 2; + Console.WriteLine ("OK"); + return 0; + } +} |