[Mono-osx] Nunit 2.2.9, gmcs and Mono 1.2.2.1

Susan Mackay susanmackay at optusnet.com.au
Thu Jan 11 05:14:11 EST 2007


OK, which part of my brain is hurting today....

I'm trying to get the latest release of NUnit (2.2.9) to work and I'm
obviously missing something, as I get rather inconsistent results.

Below, you can see the source file and the various attempts to compile it
that I've tried. From this my problems are:

1) gmcs can't find nunit.framework, but mcs can! What's missing?

2) mcs does not correctly parse the commented-out [ExpectedException]
attribute which uses a new form of this attribute - makes me think that an
old version of Nunit.framework is being picked up. However, as you can see
by the truncated gacutil listing, the only versions there should have it.
What's going on?

(I also have an issue with Xcode and gdb (I think) incorrectly firing up
when the exception occurs in the last test, but that is for another day)

Thanks

Susan

PS: I think these are probably more mono-related questions that nunit which
is why I'm asking here first.



====================================================
Titania:~/Projects/NUnitTest susan$ cat nunittest.cs
//
//  
//  NUnitTest
//
//  Created by Susan on 7/01/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//
//

using System;
using NUnit.Framework;


namespace NUnitTest
{

        [TestFixture]
        public class MathTest
        {
                private int Zero = 0;
                private int One = 1;

                [SetUp]
                public void SetUp()
                {
                        // Do any setup that is required
                }

                [Test]
                public void ZeroIs0()
                {
                        Assert.AreEqual(0, Zero);
                }

                [Test]
                public void OneIsNot1()
                {
                        Assert.AreEqual(0, One);
                }

                [Test]
                public void ThisTestFails()
                {
                        Assert.Fail( "This test is designed to fail");
                }

                [Test]
//              [ExpectedException("System.DivideByZero")]
                [ExpectedException(typeof(System.DivideByZeroException))]
                public void DivideByZero()
                {
                        int i = One / Zero;
                        i++;
                }
        }
}

Titania:~/Projects/NUnitTest susan$ gmcs -target:library -out:NUnitTest.dll
-r:NUnit.framework NUnitTest.cs
error CS0006: cannot find metadata file `NUnit.framework'
Compilation failed: 1 error(s), 0 warnings

Titania:~/Projects/NUnitTest susan$ mcs -target:library -out:NUnitTest.dll
-r:NUnit.framework NUnitTest.cs

Titania:~/Projects/NUnitTest susan$ nunit-console NUnitTest.dll
NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A.
Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Unix 8.8.1.0    Mono Version: 1.1.4322.2032

..F.F.

Tests run: 4, Failures: 2, Not run: 0, Time: 1.360052 seconds

Tests run: 4, Failures: 2, Not run: 0, Time: 1.360052 seconds

Failures:
1) NUnitTest.MathTest.OneIsNot1 :
        expected:<0>
         but was:<1>
  at NUnitTest.MathTest.OneIsNot1 () [0x00000]
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00040] in
/private/tmp/scratch/mono-1.2.2.1/mcs/class/corlib/System.Reflection/MonoMet
hod.cs:143 

2) NUnitTest.MathTest.ThisTestFails : This test is designed to fail
  at NUnitTest.MathTest.ThisTestFails () [0x00000]
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00040] in
/private/tmp/scratch/mono-1.2.2.1/mcs/class/corlib/System.Reflection/MonoMet
hod.cs:143 

Titania:~/Projects/NUnitTest susan$ mcs --version
Mono C# compiler version 1.2.2.1

Titania:~/Projects/NUnitTest susan$ gmcs --version
Mono C# compiler version 1.2.2.1

Titania:~/Projects/NUnitTest susan$ gacutil -l
The following assemblies are installed into the GAC:
<<...lots of entries removed from this listing...>>>>
System.Windows.Forms, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
<...more removed...>
nunit.core, Version=2.2.0.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.core, Version=2.2.8.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.core, Version=2.2.9.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.framework, Version=2.2.0.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.framework, Version=2.2.8.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.framework, Version=2.2.9.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.mocks, Version=2.2.8.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.util, Version=2.2.0.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.util, Version=2.2.8.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
nunit.util, Version=2.2.9.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77
webkit-sharp, Version=1.9.0.0, Culture=neutral,
PublicKeyToken=a2b5f5c17ce02f1d
Number of items = 137
Titania:~/Projects/NUnitTest susan$ 




More information about the Mono-osx mailing list