Skip to content

Commit

Permalink
test case demonstrating bug when the virtual calls occur in different…
Browse files Browse the repository at this point in the history
… branches of a switch statement
  • Loading branch information
Iristyle committed Apr 24, 2011
1 parent fbbf8aa commit 5795813
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -77,6 +77,17 @@ public string Multiple ()
Integer, Message, Integer, Message);
}

public string MultipleCallsInSwitch(int test)
{
switch (test)
{
case 1:
return string.Format("{0}", Message);
default:
return string.Format("{0}", Message);
}
}

// make it large enough (by calling GetHashCode) not to be inlined
static Version Version {
get { return new Version (1.GetHashCode (), 2.GetHashCode (), 3.GetHashCode (), 4.GetHashCode ()); }
Expand All @@ -103,6 +114,12 @@ public void MultipleCalls ()
Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Medium(2)");
}

[Test]
public void MultipleCallsInSwitch()
{
AssertRuleSuccess<TestCase>("MultipleCallsInSwitch");
}

[Test]
public void StaticCalls ()
{
Expand Down

0 comments on commit 5795813

Please sign in to comment.