From 9ecdcd65b9173736a191662072865ec0bb075c04 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Thu, 29 Jan 2015 03:21:50 +0000 Subject: Protect the Expr field of OldExpr if it is immutable. Add unit test to check this is being enforced. --- Source/UnitTests/CoreTests/ExprImmutability.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/UnitTests/CoreTests/ExprImmutability.cs') diff --git a/Source/UnitTests/CoreTests/ExprImmutability.cs b/Source/UnitTests/CoreTests/ExprImmutability.cs index 68b71083..e13feca7 100644 --- a/Source/UnitTests/CoreTests/ExprImmutability.cs +++ b/Source/UnitTests/CoreTests/ExprImmutability.cs @@ -89,6 +89,13 @@ namespace CoreTests // Trying to assign the same Type should succeed e.Type = BasicType.Bool; } + + [Test(), ExpectedException(typeof(InvalidOperationException))] + public void ProtectedOldExpr() + { + var e = new OldExpr(Token.NoToken, Expr.True, /*immutable=*/ true); + e.Expr = Expr.False; + } } } -- cgit v1.2.3