Skip to content

Commit

Permalink
Add some failing unit tests (issues icsharpcode#118 and icsharpcode#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Nov 6, 2013
1 parent f48af6a commit a99a939
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public static void RunTest(CSharpFile file)
}
// Mutate primitive values:
foreach (var pe in copy.Descendants.OfType<PrimitiveExpression>()) {
if (pe.Ancestors.Any(a => a is PreProcessorDirective))
continue;
object oldVal = pe.Value;
pe.Value = "Mutated " + "Value";
if (copy.IsMatch(file.SyntaxTree))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@ class C {}
options.BlankLinesAfterUsings = 2;
AssertOutput("using System;\nusing System.Collections;\nusing List = System.Collections.List;\n\n\nnamespace NS\n{\n$using System.Collections.Generic;\n$using Collection = System.Collections.Collection;\n$using System.Xml;\n\n\n$class C\n${\n$}\n}\n", unit, options);
}

[Test, Ignore("#pragma warning not implemented in output visitor - issue #188")]
public void PragmaWarning()
{
var code = @"#pragma warning disable 414";
var unit = SyntaxTree.Parse(code);
var options = FormattingOptionsFactory.CreateMono();
AssertOutput("#pragma warning disable 414\n", unit, options);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,22 @@ void Bar ()
float f = 5.6f;
Console.WriteLine (""foo {0}"", (int)f);
}
}");
}

[Test, Ignore("https://github.com/icsharpcode/NRefactory/issues/118")]
public void TestNonRedundantCastDueToOverloading ()
{
TestWrongContext<RedundantCastIssue> (@"
class Foo
{
void F(string a) {}
void F(object a) {}
void Bar ()
{
F((object)string.Empty);
}
}");
}
}
Expand Down

0 comments on commit a99a939

Please sign in to comment.