New test.
[mono.git] / mcs / class / corlib / Test / System.Reflection / FieldInfoTest.cs
index e9319385f200a3d5e1cdd46e2b44df6c689c0229..4ad97602f8f7b3d9a75fbdf52ba637501d70e3c7 100644 (file)
@@ -118,6 +118,16 @@ public class FieldInfoTest : Assertion
                f.SetValue (null, 8);
        }
 
+       const int literal = 42;
+
+       [Test]
+       [ExpectedException (typeof (FieldAccessException))]
+       public void SetValueOnLiteralField ()
+       {
+               FieldInfo f = typeof (FieldInfoTest).GetField ("literal", BindingFlags.Static | BindingFlags.NonPublic);
+               f.SetValue (null, 0);
+       }
+
        public int? nullable_field;
 
        public static int? static_nullable_field;