Skip to content

Commit

Permalink
[*] fix: Add escaping character 032
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-M-C committed Apr 1, 2020
1 parent 01839b3 commit f855077
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions escape.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ var (
"\r", "\\r",
"\b", "\\b",
"\\", "\\\\",
"\032", "\\Z",
// "\"", "\\\"",
// "'", "\\'",
)
)

Expand Down
7 changes: 3 additions & 4 deletions escape_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ func TestSpecialCharacters(t *testing.T) {
printf := t.Logf
errorf := t.Errorf

speChars := `<%_%_'"` + "`" + `%\r\n\t\b
>`
speChars := `<%_%_'"` + "`" + `%\r\n\t\b >` + "\r\n\\'\032"

db, err := Open(Param{
User: "travis",
Expand All @@ -37,7 +36,7 @@ func TestSpecialCharacters(t *testing.T) {
// statememts, err := db.CreateOrAlterTableStatements(String{})

db.MustCreateTable(String{})
printf("now test special characters: '%s'", speChars)
printf("test spe string: '%s'", speChars)

// insert
s := String{
Expand Down Expand Up @@ -70,7 +69,7 @@ func TestSpecialCharacters(t *testing.T) {
errorf("nothing got")
return
}
printf("got spe string: '%s'", arr[0].S)
printf("got spe string: '%s'", arr[0].S)
if arr[0].S != speChars {
errorf("expected <%s>, got <%s>", speChars, arr[0].S)
return
Expand Down

0 comments on commit f855077

Please sign in to comment.