Skip to content

Commit

Permalink
1.format source code
Browse files Browse the repository at this point in the history
 2.add code comment
  • Loading branch information
sjgllgh committed Nov 29, 2023
1 parent 6b7f55c commit 4952fbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ object SQLCommentHelper extends CommentHelper {
while (matcher.find()) {
val commentKeyword = matcher.group(1)
val comment = matcher.group(2)

/**
* Since we are in a Scala string, and each backslash needs to be escaped in the string
* itself, we need two additional backslashes. Therefore, we end up with a total of four
* backslashes to represent a single literal backslash in the replacement string.
*/
val escapedComment = comment.replaceAll(";", "\\\\\\\\;")
matcher.appendReplacement(sb, commentKeyword + " '" + escapedComment + "'")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.junit.jupiter.api.{Assertions, Test}

class TestReplaceComment {


@Test
def TestRepComm: Unit = {
val realCode = "drop table if exists default.test;" +
Expand Down

0 comments on commit 4952fbf

Please sign in to comment.