Browse Source

fix CSharpTemp.TestDestructors

TestDestructors test cannot be run twice as a static variable holds data from
the first run.

Add an init function to set the static variable to a known state.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
pull/257/head
Tomi Valkeinen 11 years ago
parent
commit
f6679213b2
  1. 1
      tests/CSharpTemp/CSharpTemp.Tests.cs
  2. 1
      tests/CSharpTemp/CSharpTemp.h

1
tests/CSharpTemp/CSharpTemp.Tests.cs

@ -89,6 +89,7 @@ public class CSharpTempTests : GeneratorTestFixture
[Test] [Test]
public void TestDestructors() public void TestDestructors()
{ {
CSharpTemp.TestDestructors.InitMarker();
Assert.AreEqual(0, CSharpTemp.TestDestructors.Marker); Assert.AreEqual(0, CSharpTemp.TestDestructors.Marker);
var dtors = new TestDestructors(); var dtors = new TestDestructors();

1
tests/CSharpTemp/CSharpTemp.h

@ -138,6 +138,7 @@ private:
// Tests destructors // Tests destructors
struct DLL_API TestDestructors struct DLL_API TestDestructors
{ {
static void InitMarker() { Marker = 0; }
static int Marker; static int Marker;
TestDestructors(); TestDestructors();

Loading…
Cancel
Save