diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/PatternMatchingTest.cs b/ICSharpCode.NRefactory.ConsistencyCheck/PatternMatchingTest.cs index 5ffa12521..ea3653563 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/PatternMatchingTest.cs +++ b/ICSharpCode.NRefactory.ConsistencyCheck/PatternMatchingTest.cs @@ -54,6 +54,8 @@ public static void RunTest(CSharpFile file) } // Mutate primitive values: foreach (var pe in copy.Descendants.OfType()) { + if (pe.Ancestors.Any(a => a is PreProcessorDirective)) + continue; object oldVal = pe.Value; pe.Value = "Mutated " + "Value"; if (copy.IsMatch(file.SyntaxTree)) diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs index 761a5d110..218a84bb0 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs @@ -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); + } } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCastIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCastIssueTests.cs index f8dba6eb9..53ffebc6c 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCastIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCastIssueTests.cs @@ -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 (@" +class Foo +{ + void F(string a) {} + void F(object a) {} + + void Bar () + { + F((object)string.Empty); + } }"); } }