Browse Source

Verified some closed parser bugs.

pull/32/merge
Mike Krüger 13 years ago
parent
commit
0ca7612a0f
  1. 31
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs

31
ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Bugs
/// <summary> /// <summary>
/// Bug 4252 - override bug in mcs ast /// Bug 4252 - override bug in mcs ast
/// </summary> /// </summary>
[Ignore("Still open")] [Ignore("Still open 03/2013")]
[Test] [Test]
public void TestBug4242() public void TestBug4242()
{ {
@ -119,7 +119,7 @@ class TestClass
/// <summary> /// <summary>
/// Bug 3952 - Syntax errors that causes AST not inserted /// Bug 3952 - Syntax errors that causes AST not inserted
/// </summary> /// </summary>
[Ignore("Still open")] [Ignore("Still open 03/2013")]
[Test] [Test]
public void TestBug3952() public void TestBug3952()
{ {
@ -321,7 +321,6 @@ class Test
/// <summary> /// <summary>
/// Bug 4556 - AST broken for unclosed invocation /// Bug 4556 - AST broken for unclosed invocation
/// </summary> /// </summary>
[Ignore ()]
[Test] [Test]
public void TestBug4556() public void TestBug4556()
{ {
@ -337,8 +336,7 @@ class Foo
} }
"; ";
var unit = SyntaxTree.Parse(code); var unit = SyntaxTree.Parse(code);
var type = unit.Members.First(m => m is TypeDeclaration) as TypeDeclaration;
var type = unit.Members.First() as TypeDeclaration;
var method = type.Members.First() as MethodDeclaration; var method = type.Members.First() as MethodDeclaration;
bool passed = !method.Body.IsNull; bool passed = !method.Body.IsNull;
if (!passed) { if (!passed) {
@ -351,7 +349,6 @@ class Foo
/// <summary> /// <summary>
/// Bug 5064 - Autocomplete doesn't include object initializer properties in yield return /// Bug 5064 - Autocomplete doesn't include object initializer properties in yield return
/// </summary> /// </summary>
[Ignore("Still open")]
[Test] [Test]
public void TestBug5064() public void TestBug5064()
{ {
@ -365,15 +362,32 @@ class Foo
}"; }";
var unit = SyntaxTree.Parse(code); var unit = SyntaxTree.Parse(code);
bool passed = unit.GetText().Trim() == @"public class Bar string text = unit.GetText().Trim();
string expected = @"public class Bar
{ {
public IEnumerable<Foo> GetFoos() public IEnumerable<Foo> GetFoos()
{ {
yield return new Foo { }; yield return new Foo { };
} }
}"; }";
int i = 0, j = 0;
while (i < text.Length && j < expected.Length) {
if (char.IsWhiteSpace (text[i])) {
i++;
continue;
}
if (char.IsWhiteSpace (expected[j])) {
j++;
continue;
}
if (text [i] != expected [j]) {
break;
}
i++;j++;
}
bool passed = i == text.Length && j == expected.Length;
if (!passed) { if (!passed) {
Console.WriteLine("Expected:" + code); Console.WriteLine("Expected:" + expected);
Console.WriteLine("Was:" + unit.GetText()); Console.WriteLine("Was:" + unit.GetText());
} }
Assert.IsTrue(passed); Assert.IsTrue(passed);
@ -382,7 +396,6 @@ class Foo
/// <summary> /// <summary>
/// Bug 5389 - Code completion does not work well inside a dictionary initializer /// Bug 5389 - Code completion does not work well inside a dictionary initializer
/// </summary> /// </summary>
[Ignore("Still open")]
[Test()] [Test()]
public void TestBug5389() public void TestBug5389()
{ {

Loading…
Cancel
Save