diff --git a/Src/CSharpier.Tests/TestFiles/Directives/BasicDirectives.actual.cst b/Src/CSharpier.Tests/TestFiles/Directives/Directives.actual.cst similarity index 55% rename from Src/CSharpier.Tests/TestFiles/Directives/BasicDirectives.actual.cst rename to Src/CSharpier.Tests/TestFiles/Directives/Directives.actual.cst index fd91fb04a..d826b1c4d 100644 --- a/Src/CSharpier.Tests/TestFiles/Directives/BasicDirectives.actual.cst +++ b/Src/CSharpier.Tests/TestFiles/Directives/Directives.actual.cst @@ -11,3 +11,20 @@ #undef foo #line 6 class ClassName { } + +public class ClassName +{ + void MethodName() + { +#if DEBUG + Console.WriteLine("Rosyln does not parse this because DEBUG is not defined"); +#endif + } +} + +namespace Namespace +{ + +#pragma + class ExtraLineChecker { } +} diff --git a/Src/CSharpier.Tests/TestFiles/Directives/BasicDirectives.cst b/Src/CSharpier.Tests/TestFiles/Directives/Directives.cst similarity index 55% rename from Src/CSharpier.Tests/TestFiles/Directives/BasicDirectives.cst rename to Src/CSharpier.Tests/TestFiles/Directives/Directives.cst index 1b6b308e1..b43f5a416 100644 --- a/Src/CSharpier.Tests/TestFiles/Directives/BasicDirectives.cst +++ b/Src/CSharpier.Tests/TestFiles/Directives/Directives.cst @@ -11,3 +11,19 @@ #undef foo #line 6 class ClassName { } + +public class ClassName +{ + void MethodName() + { +#if DEBUG + Console.WriteLine("Rosyln does not parse this because DEBUG is not defined"); +#endif + } +} + +namespace Namespace +{ +#pragma + class ExtraLineChecker { } +} diff --git a/Src/CSharpier.Tests/TestFiles/Directives/IfDirectiveEmptyBlock.actual.cst b/Src/CSharpier.Tests/TestFiles/Directives/IfDirectiveEmptyBlock.actual.cst deleted file mode 100644 index 48bf66f8b..000000000 --- a/Src/CSharpier.Tests/TestFiles/Directives/IfDirectiveEmptyBlock.actual.cst +++ /dev/null @@ -1,9 +0,0 @@ -public class ClassName -{ - void MethodName() - { -#if DEBUG - Console.WriteLine("Rosyln does not parse this because DEBUG is not defined"); -#endif - } -} diff --git a/Src/CSharpier.Tests/TestFiles/Directives/IfDirectiveEmptyBlock.cst b/Src/CSharpier.Tests/TestFiles/Directives/IfDirectiveEmptyBlock.cst deleted file mode 100644 index bdaad0dec..000000000 --- a/Src/CSharpier.Tests/TestFiles/Directives/IfDirectiveEmptyBlock.cst +++ /dev/null @@ -1,9 +0,0 @@ -public class ClassName -{ - void MethodName() - { -#if DEBUG - Console.WriteLine("Rosyln does not parse this because DEBUG is not defined"); -#endif - } -} diff --git a/Src/CSharpier.Tests/TestFiles/Directives/_DirectivesTests.cs b/Src/CSharpier.Tests/TestFiles/Directives/_DirectivesTests.cs index 448a17547..de8919708 100644 --- a/Src/CSharpier.Tests/TestFiles/Directives/_DirectivesTests.cs +++ b/Src/CSharpier.Tests/TestFiles/Directives/_DirectivesTests.cs @@ -6,14 +6,9 @@ namespace CSharpier.Tests.TestFiles public class DirectivesTests : BaseTest { [Test] - public void BasicDirectives() + public void Directives() { - this.RunTest("Directives", "BasicDirectives"); - } - [Test] - public void IfDirectiveEmptyBlock() - { - this.RunTest("Directives", "IfDirectiveEmptyBlock"); + this.RunTest("Directives", "Directives"); } [Test] public void Regions() diff --git a/Src/CSharpier/PrinterHelpers/SyntaxTrivia.cs b/Src/CSharpier/PrinterHelpers/SyntaxTrivia.cs index a8b19037b..08958b14e 100644 --- a/Src/CSharpier/PrinterHelpers/SyntaxTrivia.cs +++ b/Src/CSharpier/PrinterHelpers/SyntaxTrivia.cs @@ -151,6 +151,8 @@ private Doc PrintLeadingTrivia(SyntaxTriviaList leadingTrivia) ) { hadDirective = true; + // GH-22 the problem is that we have a hardline followed by a literalline. What we really mean by literalLine is, add a line and dedent if this isn't preceded by a hardline.... I think + // we should probably figure out better new lines for directives, because that could affect this. parts.Push(LiteralLine, trivia.ToString()); } else if (