From 6bd0bfc5a832728d831b3d6503e4ca19f58f735c Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 28 Jul 2012 21:22:16 +0200 Subject: [PATCH] Add failing unit test for CompilationUnit.ConditionalSymbols. --- ICSharpCode.NRefactory.CSharp/Resolver/Log.cs | 5 ----- .../PreprocessorDirectiveTests.cs | 19 +++++++++++++++++++ ICSharpCode.NRefactory/Utils/LazyInit.cs | 3 --- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs b/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs index a167cd6999..9e85f451f0 100644 --- a/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs @@ -19,12 +19,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; using System.Linq; -using System.Text; -using System.Threading; -using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.NRefactory.TypeSystem.Implementation; namespace ICSharpCode.NRefactory.CSharp.Resolver { diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs index 28b522fc6c..bc91fe3de6 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs @@ -245,5 +245,24 @@ class B { } Assert.AreEqual(PreProcessorDirectiveType.Elif, bbb.Type); Assert.AreEqual("BBB", bbb.Argument); } + + [Test] + [Ignore("parser bug (BBB is missing)")] + public void ConditionalSymbolTest() + { + const string program = @"// Test +#if AAA +#undef AAA +#define CCC +#else +#define DDD +#endif +class C {}"; + CSharpParser parser = new CSharpParser(); + parser.CompilerSettings.ConditionalSymbols.Add("AAA"); + parser.CompilerSettings.ConditionalSymbols.Add("BBB"); + var cu = parser.Parse(program, "elif.cs"); + Assert.AreEqual(new[] { "BBB", "CCC" }, cu.ConditionalSymbols); + } } } diff --git a/ICSharpCode.NRefactory/Utils/LazyInit.cs b/ICSharpCode.NRefactory/Utils/LazyInit.cs index 94c08bbea4..467a8daa35 100644 --- a/ICSharpCode.NRefactory/Utils/LazyInit.cs +++ b/ICSharpCode.NRefactory/Utils/LazyInit.cs @@ -17,10 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Threading; -using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.Utils {