diff options
author | Miguel de Icaza <miguel@gnome.org> | 2005-04-20 06:36:19 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2005-04-20 06:36:19 +0400 |
commit | 24b731c8c43fe97384b4257d0a3bd241845349f8 (patch) | |
tree | 2a094d7fbe7ba78dcd0de6f8a0b02d5296fd0252 /mcs/tests/test-364.cs | |
parent | cc0d374e7c19f6720a32f0cb8fa6114851622960 (diff) |
Updated test
svn path=/trunk/mcs/; revision=43308
Diffstat (limited to 'mcs/tests/test-364.cs')
-rw-r--r-- | mcs/tests/test-364.cs | 67 |
1 files changed, 57 insertions, 10 deletions
diff --git a/mcs/tests/test-364.cs b/mcs/tests/test-364.cs index b8bc6c916d7..d27786db7a9 100644 --- a/mcs/tests/test-364.cs +++ b/mcs/tests/test-364.cs @@ -1,15 +1,62 @@ +// +// Test for bug: 69614 +// +// Basically, this tests that we can capture parameters and use them outside the delegate +// +using System; + class X { - static void Main () + delegate int Foo (); + + static int Main () { - int n = 0; - - try { - } finally { - switch (n){ - case 0: - break; - } - } + int x = t1 (1); + if (x != 1) + return 1; + x = t2 (2); + if (x != 3) + return 2; + return 0; + } + + static int t1 (int p) + { + Foo f = delegate { + return p; + }; + return f (); + } + + static int t2 (int p) + { + p++; + Foo f = delegate { + return p; + }; + return f (); } + + // + // This is just here to check that it compiles, but the logic is the + // same as the ones before + + static void Main2 (string[] argv) + { + Console.WriteLine ("Test"); + + Delegable db = new Delegable (); + if (argv.Length > 1) { + db.MyDelegate += delegate (object o, EventArgs args) { + Console.WriteLine ("{0}", argv); + Console.WriteLine ("{0}", db); + }; + } + } } + +class Delegable { + public event EventHandler MyDelegate; +} + + |