diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-01-29 03:21:50 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-01-29 03:21:50 +0000 |
commit | 9ecdcd65b9173736a191662072865ec0bb075c04 (patch) | |
tree | 9466bdf4628aba85ab52003c7479c7996550f502 /Source/UnitTests/CoreTests/ExprImmutability.cs | |
parent | 506c17c312bf12188a9b1eabcdf80a71f92d9bb9 (diff) |
Protect the Expr field of OldExpr if it is immutable. Add unit test
to check this is being enforced.
Diffstat (limited to 'Source/UnitTests/CoreTests/ExprImmutability.cs')
-rw-r--r-- | Source/UnitTests/CoreTests/ExprImmutability.cs | 7 |
1 files changed, 7 insertions, 0 deletions
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; + } } } |