diff options
author | Marek Safar <marek.safar@gmail.com> | 2010-06-01 17:23:38 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2010-06-01 17:23:38 +0400 |
commit | f407d37371d19a10fb270d954dedb7bba5df8a11 (patch) | |
tree | 14b39a18b93990e4a7ade6ca4e25adb542b86689 /mcs/tests/gtest-513.cs | |
parent | ade2c76b12e78295d4e6d085b8f1461ee90914f7 (diff) |
New test.
svn path=/trunk/mcs/; revision=158276
Diffstat (limited to 'mcs/tests/gtest-513.cs')
-rw-r--r-- | mcs/tests/gtest-513.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/mcs/tests/gtest-513.cs b/mcs/tests/gtest-513.cs new file mode 100644 index 00000000000..eac3920f255 --- /dev/null +++ b/mcs/tests/gtest-513.cs @@ -0,0 +1,65 @@ +using System; + +struct S : IDisposable +{ + public static int hit; + + void IDisposable.Dispose () + { + hit++; + } + + public void Dispose () + { + throw new ApplicationException (); + } +} + +class C : IDisposable +{ + + void IDisposable.Dispose () + { + } + + public void Dispose () + { + throw new ApplicationException (); + } +} + +class Test +{ + public static int Main () + { + using (new S? ()) { + } + + if (S.hit != 0) + return 1; + + using (new C ()) { + } + + var s = new S (); + using (s) { + } + + if (S.hit != 1) + return 2; + + GenMethod (s); + + if (S.hit != 2) + return 3; + + Console.WriteLine ("ok"); + return 0; + } + + static void GenMethod<T> (T t) where T : IDisposable + { + using (t) { + } + } +} |