X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FTest%2FSystem.Diagnostics%2FStackFrameTest.cs;h=4a94446c6a6cce793313f4f74dd811fc8fecac1c;hb=98cf04084aab9bd6eef5e4e37cc92117fdac2cf0;hp=867bb39272f2eef0638f039635e3b2f394a21f26;hpb=1fabd87b02f8d2e359150ed7a9e92613e60383bc;p=mono.git diff --git a/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs index 867bb39272f..4a94446c6a6 100644 --- a/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs +++ b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs @@ -19,7 +19,7 @@ namespace MonoTests.System.Diagnostics /// location inside it. /// [TestFixture] - public class StackFrameTest1 : Assertion + public class StackFrameTest1 { private StackFrame frame1; private StackFrame frame2; @@ -42,30 +42,32 @@ namespace MonoTests.System.Diagnostics /// Tests whether getting file name works. /// [Test] + [Category("LLVMNotWorking")] public void TestGetFileName () { - AssertEquals ("File name (1)", - "dir/someFile", - frame1.GetFileName ()); + Assert.AreEqual ("dir/someFile", + frame1.GetFileName (), + "File name (1)"); - AssertEquals ("File name (2)", - "SomeFile2.cs", - frame2.GetFileName ()); + Assert.AreEqual ("SomeFile2.cs", + frame2.GetFileName (), + "File name (2)"); } /// /// Tests whether getting file line number works. /// [Test] + [Category("LLVMNotWorking")] public void TestGetFileLineNumber () { - AssertEquals ("Line number (1)", - 13, - frame1.GetFileLineNumber ()); + Assert.AreEqual (13, + frame1.GetFileLineNumber (), + "Line number (1)"); - AssertEquals ("Line number (2)", - 24, - frame2.GetFileLineNumber ()); + Assert.AreEqual (24, + frame2.GetFileLineNumber (), + "Line number (2)"); } /// @@ -74,13 +76,13 @@ namespace MonoTests.System.Diagnostics [Test] public void TestGetFileColumnNumber () { - AssertEquals ("Column number (1)", - 45, - frame1.GetFileColumnNumber ()); + Assert.AreEqual (45, + frame1.GetFileColumnNumber (), + "Column number (1)"); - AssertEquals ("Column number (2)", - 0, - frame2.GetFileColumnNumber ()); + Assert.AreEqual (0, + frame2.GetFileColumnNumber (), + "Column number (2)"); } /// @@ -89,23 +91,23 @@ namespace MonoTests.System.Diagnostics [Test] public void TestGetMethod () { - Assert ("Method not null (1)", (frame1.GetMethod () != null)); - - AssertEquals ("Class declaring the method (1)", - this.GetType (), - frame1.GetMethod ().DeclaringType); - AssertEquals ("Method name (1)", - "SetUp", - frame1.GetMethod ().Name); - - Assert ("Method not null (2)", (frame2.GetMethod () != null)); - - AssertEquals ("Class declaring the method (2)", - this.GetType (), - frame2.GetMethod ().DeclaringType); - AssertEquals ("Method name (2)", - "SetUp", - frame2.GetMethod ().Name); + Assert.IsTrue ((frame1.GetMethod () != null), "Method not null (1)"); + + Assert.AreEqual (this.GetType (), + frame1.GetMethod ().DeclaringType, + "Class declaring the method (1)"); + Assert.AreEqual ("SetUp", + frame1.GetMethod ().Name, + "Method name (1)"); + + Assert.IsTrue ((frame2.GetMethod () != null), "Method not null (2)"); + + Assert.AreEqual (this.GetType (), + frame2.GetMethod ().DeclaringType, + "Class declaring the method (2)"); + Assert.AreEqual ("SetUp", + frame2.GetMethod ().Name, + "Method name (2)"); } } @@ -119,7 +121,7 @@ namespace MonoTests.System.Diagnostics /// debug information? /// [TestFixture] - public class StackFrameTest2 : Assertion + public class StackFrameTest2 { private StackFrame frame1; private StackFrame frame2; @@ -147,37 +149,44 @@ namespace MonoTests.System.Diagnostics [Test] public void TestGetFileName1 () { - AssertNull ("File name (1)", - frame1.GetFileName ()); + Assert.IsNull (frame1.GetFileName (), + "File name (1)"); } [Test] + [Category ("LLVMNotWorking")] public void TestGetFileName2 () { - AssertNotNull ("File name not null", frame2.GetFileName ()); - Assert ("File name not empty", frame2.GetFileName ().Length != 0); - Assert ("File name (2) " + frame2.GetFileName () - + " ends with StackFrameTest.cs", - frame2.GetFileName ().EndsWith ("StackFrameTest.cs")); +#if MOBILE && !DEBUG + Assert.Ignore ("The .mdb file won't be present inside the app and no file name will be available"); +#endif + Assert.IsNotNull (frame2.GetFileName (), "File name not null"); + Assert.IsTrue (frame2.GetFileName ().Length != 0, "File name not empty"); + Assert.IsTrue (frame2.GetFileName ().EndsWith ("StackFrameTest.cs"), + "File name (2) " + frame2.GetFileName () + " ends with StackFrameTest.cs"); } /// /// Tests whether getting file line number works. /// [Test] + [Category ("LLVMNotWorking")] public void TestGetFileLineNumber () { - AssertEquals ("Line number (1)", - 0, - frame1.GetFileLineNumber ()); +#if MOBILE && !DEBUG + Assert.Ignore ("The .mdb file won't be present inside the app and no line number will be available"); +#endif + Assert.AreEqual (0, + frame1.GetFileLineNumber (), + "Line number (1)"); - AssertEquals ("Line number (2)", - 132, - frame2.GetFileLineNumber ()); + Assert.AreEqual (134, + frame2.GetFileLineNumber (), + "Line number (2)"); - AssertEquals ("Line number (3)", - 0, - frame3.GetFileLineNumber ()); + Assert.AreEqual (0, + frame3.GetFileLineNumber (), + "Line number (3)"); } /// @@ -187,17 +196,17 @@ namespace MonoTests.System.Diagnostics [Category ("NotWorking")] // bug #45730 - Column numbers always zero public void TestGetFileColumnNumber () { - AssertEquals ("Column number (1)", - 0, - frame1.GetFileColumnNumber ()); + Assert.AreEqual (0, + frame1.GetFileColumnNumber (), + "Column number (1)"); - AssertEquals ("Column number (2)", - 4, - frame2.GetFileColumnNumber ()); + Assert.AreEqual (4, + frame2.GetFileColumnNumber (), + "Column number (2)"); - AssertEquals ("Column number (3)", - 0, - frame3.GetFileColumnNumber ()); + Assert.AreEqual (0, + frame3.GetFileColumnNumber (), + "Column number (3)"); } /// @@ -206,35 +215,35 @@ namespace MonoTests.System.Diagnostics [Test] public void TestGetMethod () { - Assert ("Method not null (1)", - (frame1.GetMethod () != null)); - - AssertEquals ("Class declaring the method (1)", - this.GetType (), - frame1.GetMethod ().DeclaringType); - AssertEquals ("Method name (1)", - "SetUp", - frame1.GetMethod ().Name); - - Assert ("Method not null (2)", - (frame2.GetMethod () != null)); - - AssertEquals ("Class declaring the method (2)", - this.GetType (), - frame2.GetMethod ().DeclaringType); - AssertEquals ("Method name (2)", - "SetUp", - frame2.GetMethod ().Name); - - Assert ("Method not null (3)", - (frame3.GetMethod () != null)); - - AssertEquals ("Class declaring the method (3)", - this.GetType (), - frame3.GetMethod ().DeclaringType); - AssertEquals ("Method name (3)", - "SetUp", - frame3.GetMethod ().Name); + Assert.IsNotNull (frame1.GetMethod (), + "Method not null (1)"); + + Assert.AreEqual (this.GetType (), + frame1.GetMethod ().DeclaringType, + "Class declaring the method (1)"); + Assert.AreEqual ("SetUp", + frame1.GetMethod ().Name, + "Method name (1)"); + + Assert.IsNotNull (frame2.GetMethod (), + "Method not null (2)"); + + Assert.AreEqual (this.GetType (), + frame2.GetMethod ().DeclaringType, + "Class declaring the method (2)"); + Assert.AreEqual ("SetUp", + frame2.GetMethod ().Name, + "Method name (2)"); + + Assert.IsNotNull (frame3.GetMethod (), + "Method not null (3)"); + + Assert.AreEqual (this.GetType (), + frame3.GetMethod ().DeclaringType, + "Class declaring the method (3)"); + Assert.AreEqual ("SetUp", + frame3.GetMethod ().Name, + "Method name (3)"); } } @@ -249,7 +258,7 @@ namespace MonoTests.System.Diagnostics /// debug information? /// [TestFixture] - public class StackFrameTest3 : Assertion + public class StackFrameTest3 { protected StackFrame frame1; protected StackFrame frame2; @@ -281,54 +290,55 @@ namespace MonoTests.System.Diagnostics /// Tests whether getting file name works. /// [Test] + [Category ("LLVMNotWorking")] public void TestGetFileName () { - AssertNull ("File name (1)", - frame1.GetFileName ()); +#if MOBILE && !DEBUG + Assert.Ignore ("The .mdb file won't be present inside the app and no file name will be available"); +#endif + Assert.IsNull (frame1.GetFileName (), + "File name (1)"); - AssertNotNull ("File name (2) should not be null", - frame2.GetFileName ()); + Assert.IsNotNull (frame2.GetFileName (), + "File name (2) should not be null"); - Assert ("File name (2) " + frame2.GetFileName () - + " ends with StackFrameTest.cs", - frame2.GetFileName ().EndsWith ("StackFrameTest.cs")); + Assert.IsTrue (frame2.GetFileName ().EndsWith ("StackFrameTest.cs"), + "File name (2) " + frame2.GetFileName () + " ends with StackFrameTest.cs"); } /// /// Tests whether getting file line number works. /// [Test] -#if ONLY_1_1 - [Category ("NotDotNet")] // .NET 1.1 is off by one -#endif + [Category ("LLVMNotWorking")] public void TestGetFileLineNumber () { - AssertEquals ("Line number (1)", - 0, - frame1.GetFileLineNumber ()); +#if MOBILE && !DEBUG + Assert.Ignore ("The .mdb file won't be present inside the app and no line number will be available"); +#endif + Assert.AreEqual (0, + frame1.GetFileLineNumber (), + "Line number (1)"); - AssertEquals ("Line number (2)", - 261, - frame2.GetFileLineNumber ()); + Assert.AreEqual (270, + frame2.GetFileLineNumber (), + "Line number (2)"); } /// /// Tests whether getting file column number works. /// [Test] -#if ONLY_1_1 - [Category ("NotDotNet")] // .NET 1.1 is off by one -#endif [Category ("NotWorking")] // bug #45730 - Column numbers always zero public void TestGetFileColumnNumber () { - AssertEquals ("Column number (1)", - 0, - frame1.GetFileColumnNumber ()); + Assert.AreEqual (0, + frame1.GetFileColumnNumber (), + "Column number (1)"); - AssertEquals ("Column number (2)", - 4, - frame2.GetFileColumnNumber ()); + Assert.AreEqual (4, + frame2.GetFileColumnNumber (), + "Column number (2)"); } /// @@ -337,17 +347,17 @@ namespace MonoTests.System.Diagnostics [Test] public void TestGetMethod () { - Assert ("Method not null (1)", (frame1.GetMethod () != null)); + Assert.IsTrue ((frame1.GetMethod () != null), "Method not null (1)"); - Assert ("Method not null (2)", (frame2.GetMethod () != null)); + Assert.IsTrue ((frame2.GetMethod () != null), "Method not null (2)"); - AssertEquals ("Class declaring the method (2)", - this.GetType (), - frame2.GetMethod ().DeclaringType); + Assert.AreEqual (this.GetType (), + frame2.GetMethod ().DeclaringType, + "Class declaring the method (2)"); - AssertEquals ("Method name (2)", - "SetUp", - frame2.GetMethod ().Name); + Assert.AreEqual ("SetUp", + frame2.GetMethod ().Name, + "Method name (2)"); } } }