Skip to content

Commit

Permalink
Add test: GO statement with trailing comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpareja committed Mar 23, 2013
1 parent e60c7e3 commit 4156cff
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions product/roundhouse.tests/sqlsplitters/StatementSplitterSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void should_replace_on_go_with_on_new_line_after_double_dash_comments_and
}

[Observation]
public void should_replace_on_go_with_on_new_line_after_double_dash_comments_and_symbols()
public void should_replace_on_go_with_new_line_after_double_dash_comments_and_symbols()
{
string sql_to_match = @"-- " + symbols_to_check + @"
GO
Expand Down Expand Up @@ -236,10 +236,22 @@ public void should_replace_on_go_after_double_dash_comment_with_single_quote_and
{
string sql_to_match = words_to_check + @" -- '
GO
select ''";
select ''
go";
string expected_scrubbed = words_to_check + @" -- '
" + batch_terminator_replacement_string + @"
select ''";
select ''
" + batch_terminator_replacement_string;
Console.WriteLine(sql_to_match);
string sql_statement_scrubbed = script_regex_replace.Replace(sql_to_match, match => StatementSplitter.evaluate_and_replace_batch_split_items(match, script_regex_replace));
Assert.AreEqual(expected_scrubbed, sql_statement_scrubbed);
}

[Observation]
public void should_replace_on_go_with_comment_after()
{
string sql_to_match = " GO -- comment";
string expected_scrubbed = " " + batch_terminator_replacement_string + " -- comment";
Console.WriteLine(sql_to_match);
string sql_statement_scrubbed = script_regex_replace.Replace(sql_to_match, match => StatementSplitter.evaluate_and_replace_batch_split_items(match, script_regex_replace));
Assert.AreEqual(expected_scrubbed, sql_statement_scrubbed);
Expand Down Expand Up @@ -619,4 +631,5 @@ public void should_not_replace_on_assigning_values_to_variables()
}
}
}
}
}

0 comments on commit 4156cff

Please sign in to comment.