From 5a6b477907032eac8c947d87e704d7334e876494 Mon Sep 17 00:00:00 2001 From: jbevain Date: Wed, 19 May 2010 13:36:47 +0000 Subject: [PATCH] 2010-05-19 Jb Evain * ExpressionTest_Constant.cs: add tests for nullable constants. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@157551 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- .../Test/System.Linq.Expressions/ChangeLog | 4 ++++ .../ExpressionTest_Constant.cs | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/class/System.Core/Test/System.Linq.Expressions/ChangeLog b/class/System.Core/Test/System.Linq.Expressions/ChangeLog index 164746fab5..b529a71b3c 100644 --- a/class/System.Core/Test/System.Linq.Expressions/ChangeLog +++ b/class/System.Core/Test/System.Linq.Expressions/ChangeLog @@ -1,3 +1,7 @@ +2010-05-19 Jb Evain + + * ExpressionTest_Constant.cs: add tests for nullable constants. + 2009-09-03 Jb Evain * ExpressionTest_Constant.cs: add test to emit dbnull constants. diff --git a/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Constant.cs b/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Constant.cs index 1d5d368f32..b8c3bdc947 100644 --- a/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Constant.cs +++ b/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Constant.cs @@ -245,6 +245,26 @@ namespace MonoTests.System.Linq.Expressions Assert.IsNull (n ()); } + [Test] + public void EmitNullableInt () + { + var i = Expression.Lambda> ( + Expression.Constant ((int?) 42, typeof (int?))).Compile (); + + Assert.AreEqual ((int?) 42, i ()); + } + + [Test] + public void EmitNullableEnum () + { + var e = Expression.Lambda> ( + Expression.Constant ((Chose?) Chose.Moche, typeof (Chose?))).Compile (); + + Assert.AreEqual ((Chose?) Chose.Moche, e ()); + } + + enum Chose { Moche } + interface IBar {} class Bar : IBar {} -- 2.11.4.GIT