public void SingleLineComment_ShouldEndAtEOF() { string sql = "before\n--comment"; string result = CommentStripper.ProcessSql(sql); result.Should().Be("before\n"); }
public void SingleLineComment_ASingleDashShouldBePreserved() { string sql = "-"; // this test really has to do with our particular state machine implementation string result = CommentStripper.ProcessSql(sql); result.Should().Be("-"); }
public void SingleLine_SingleDashShouldNotConfuse() { string sql = "before\n-not a comment"; string result = CommentStripper.ProcessSql(sql); result.Should().Be(sql); // should not be changed! }
public void SingleLineComment_ShouldEndAtFirstNewLine() { string sql = "--comment\n\n"; string result = CommentStripper.ProcessSql(sql); result.Should().Be("\n\n"); }
public void SingleLineComment_ShouldPreserveBeforeAndAfter() { string sql = "before\n--comment\n after\n"; string result = CommentStripper.ProcessSql(sql); result.Should().Be("before\n\n after\n"); }
public void MultiLine_NestedSingleLineCommentsShouldBeIgnored() { string sql = "a/*--no\n --problem\n*/b"; string result = CommentStripper.ProcessSql(sql); result.Should().Be("ab"); }
public void SingleLineComment_ShouldBeRemovedLeavingANewLine() { string sql = "--comment\n"; string result = CommentStripper.ProcessSql(sql); result.Should().Be("\n"); }
public void MultiLine_ExtraStarsShouldBeIgnored() { string sql = "/***/"; string result = CommentStripper.ProcessSql(sql); result.Should().Be(""); }
public void MultiLine_BeforeAndAfterShouldBePreserved() { string sql = "before/*comment*/after"; string result = CommentStripper.ProcessSql(sql); result.Should().Be("beforeafter"); }
public void MultiLine_ShouldTerminateAtFirstEnd() { string sql = "/*abc*/def*/"; // this is an SQL error, but fine as far as the comment stripper is concerned string result = CommentStripper.ProcessSql(sql); result.Should().Be("def*/"); }
public void MultiLine_ShouldBeRemovedAcrossNewLines() { string sql = "/*line1\nline2*/"; string result = CommentStripper.ProcessSql(sql); result.Should().Be(""); }
public void MultiLine_ShouldBeRemoved() { string sql = "/*comment*/"; string result = CommentStripper.ProcessSql(sql); result.Should().Be(""); }
public void SingleLine_NestedSlashStarsShouldBeIgnored() { string sql = "a--/*...*/ */ /* /* \n b"; string result = CommentStripper.ProcessSql(sql); string expected = "a\n b"; result.Should().Be(expected); // should not be changed! }
public void SingleLine_MultipleCommentsAndSingleDashes() { string sql = "before\n--comment\n a - b; c - d; --comment\n after"; string result = CommentStripper.ProcessSql(sql); string expected = "before\n\n a - b; c - d; \n after"; result.Should().Be(expected); // should not be changed! }