2010-04-27 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / tests / dtest.cs
index 32b6809a76903694807f386eb93b9984b6a79239..efc01e896e284e82bcc94dbe217930277605fec7 100644 (file)
@@ -885,6 +885,7 @@ public class DebuggerTests
        }
 
        [Test]
+       [Category ("only")]
        public void Type_SetValue () {
                var e = run_until ("o1");
                var frame = e.Thread.GetFrames () [0];
@@ -901,6 +902,10 @@ public class DebuggerTests
                f = o.Type.GetValue (o.Type.GetField ("static_i"));
                AssertValue (55, f);
 
+               o.Type.SetValue (o.Type.GetField ("static_s"), vm.RootDomain.CreateString ("B"));
+               f = o.Type.GetValue (o.Type.GetField ("static_s"));
+               AssertValue ("B", f);
+
                // Argument checking
                AssertThrows<ArgumentNullException> (delegate () {
                                o.Type.SetValue (null, vm.CreateValue (0));
@@ -1616,6 +1621,24 @@ public class DebuggerTests
                        });
        }
 
+       [Test]
+       [Category ("only")]
+       public void CreateBoxedValue () {
+               ObjectMirror o = vm.RootDomain.CreateBoxedValue (new PrimitiveValue (vm, 42));
+
+               Assert.AreEqual ("Int32", o.Type.Name);
+               //AssertValue (42, m.GetValue (o.Type.GetField ("m_value")));
+
+               // Argument checking
+               AssertThrows <ArgumentNullException> (delegate () {
+                               vm.RootDomain.CreateBoxedValue (null);
+                       });
+
+               AssertThrows <ArgumentException> (delegate () {
+                               vm.RootDomain.CreateBoxedValue (o);
+                       });
+       }
+
        [Test]
        public void Invoke () {
                Event e = run_until ("invoke1");
@@ -1749,7 +1772,6 @@ public class DebuggerTests
        }
 
        [Test]
-       [Category ("only")]
        public void InvokeVType () {
                Event e = run_until ("invoke1");
 
@@ -1771,6 +1793,18 @@ public class DebuggerTests
                m = t.GetMethod ("invoke_return_intptr");
                v = s.InvokeMethod (e.Thread, m, null);
                AssertValue (43, v);
+
+               // Static method
+               m = t.GetMethod ("invoke_static");
+               v = t.InvokeMethod (e.Thread, m, null);
+               AssertValue (5, v);
+
+               // Pass generic struct as this
+               s = frame.GetArgument (2) as StructMirror;
+               t = s.Type;
+               m = t.GetMethod ("invoke_return_int");
+               v = s.InvokeMethod (e.Thread, m, null);
+               AssertValue (42, v);
        }
 
        [Test]
@@ -1883,6 +1917,8 @@ public class DebuggerTests
 
                Assert.AreEqual (ThreadState.Running, e.Thread.ThreadState);
 
+               Assert.IsTrue (e.Thread.ThreadId > 0);
+
                vm.EnableEvents (EventType.ThreadStart, EventType.ThreadDeath);
 
                vm.Resume ();