diff options
author | Marek Safar <marek.safar@gmail.com> | 2008-04-07 18:49:08 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2008-04-07 18:49:08 +0400 |
commit | f43de582080f2e17d034a490643754b6dcf4dd34 (patch) | |
tree | a611c8558205a8d37308beca6c4bfdaae3910118 /mcs/tests/gtest-etree-05.cs | |
parent | c26ae3d6a4998df86165e921cff2fb105f08b169 (diff) |
New tests.
svn path=/trunk/mcs/; revision=100019
Diffstat (limited to 'mcs/tests/gtest-etree-05.cs')
-rw-r--r-- | mcs/tests/gtest-etree-05.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mcs/tests/gtest-etree-05.cs b/mcs/tests/gtest-etree-05.cs new file mode 100644 index 00000000000..e9d42dc1201 --- /dev/null +++ b/mcs/tests/gtest-etree-05.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq.Expressions; +using System.Collections; +using System.Collections.Generic; + +class C +{ + static void AssertNodeType (LambdaExpression e, ExpressionType et) + { + if (e.Body.NodeType != et) + throw new ApplicationException (e.Body.NodeType + " != " + et); + } + + static void Assert<T> (T expected, T value) + { + if (!EqualityComparer<T>.Default.Equals (expected, value)) { + throw new ApplicationException (expected + " != " + value); + } + } + + static int Main() + { + // It also tests constant boxing + Expression<Func<ArrayList>> e1 = () => new ArrayList { null, "Hello", "World", 5 }; + AssertNodeType (e1, ExpressionType.ListInit); + /* Verification exception on .NET */ + var re1 = e1.Compile ().Invoke (); + Assert ("World", re1 [1]); + Assert (5, re1 [2]); + + Console.WriteLine ("OK"); + return 0; + } +} |