Browse Source

Ignore AssemblyInfo in RoundtripTest.

newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
f788f91421
  1. 9
      ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs
  2. 2
      ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs
  3. 21
      ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/NamespaceDeclarationTests.cs

9
ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs

@ -118,12 +118,11 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck @@ -118,12 +118,11 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck
public CSharpParser CreateParser()
{
List<string> args = new List<string>();
if (AllowUnsafeBlocks)
args.Add("-unsafe");
var settings = new Mono.CSharp.CompilerSettings();
settings.Unsafe = AllowUnsafeBlocks;
foreach (string define in PreprocessorDefines)
args.Add("-d:" + define);
return new CSharpParser(args.ToArray());
settings.AddConditionalSymbol(define);
return new CSharpParser(settings);
}
}

2
ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs

@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck @@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck
return; // skip due to completely messed up comment locations
if (file.FileName.Contains("FormattingTests") || file.FileName.Contains("ContextAction") || file.FileName.Contains("CodeCompletion"))
return; // skip due to AttributeSectionTests.AttributeWithEmptyParenthesis
if (file.FileName.EndsWith("TypeSystemTests.TestCase.cs"))
if (file.FileName.EndsWith("TypeSystemTests.TestCase.cs") || file.FileName.EndsWith("AssemblyInfo.cs"))
return; // skip due to AttributeSectionTests.AssemblyAttributeBeforeNamespace
if (file.FileName.EndsWith("dynamic.cs") || file.FileName.EndsWith("expression.cs"))
return; // skip due to PreprocessorDirectiveTests.NestedInactiveIf

21
ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/NamespaceDeclarationTests.cs

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.IO;
using System.Linq;
using NUnit.Framework;
@ -47,5 +48,25 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope @@ -47,5 +48,25 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope
Assert.AreEqual("N2", ns.Children.OfType<NamespaceDeclaration>().Single().Name);
}
[Test]
public void ExternAliasTest()
{
string program = "extern alias X; extern alias Y; using X::System; namespace TestNamespace { extern alias Z; using Y::System; }";
var cu = new CSharpParser().Parse(new StringReader(program), "code.cs");
Assert.AreEqual(
new Type[] {
typeof(ExternAliasDeclaration),
typeof(ExternAliasDeclaration),
typeof(UsingDeclaration),
typeof(NamespaceDeclaration)
}, cu.Children.Select(c => c.GetType()).ToArray());
var namespaceMembers = ((NamespaceDeclaration)cu.LastChild).Members;
Assert.AreEqual(
new Type[] {
typeof(ExternAliasDeclaration),
typeof(UsingDeclaration)
}, namespaceMembers.Select(c => c.GetType()).ToArray());
}
}
}

Loading…
Cancel
Save