Skip to content

Commit

Permalink
Use backticks to avoid escaping quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhrozek committed Sep 18, 2024
1 parent 9e83fb0 commit 161cf63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/db/profile_selector_scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestScan(t *testing.T) {
}{
{
name: "Valid input with all fields",
input: []byte(fmt.Sprintf("(%s,%s,repository,\"entity.name == \"\"test/test\"\" && repository.is_fork != true\",\"comment1\")", selectorId, profileId)),
input: []byte(fmt.Sprintf(`(%s,%s,repository,"entity.name == ""test/test"" && repository.is_fork != true","comment1")`, selectorId, profileId)),
expected: ProfileSelector{
ID: selectorId,
ProfileID: profileId,
Expand All @@ -52,7 +52,7 @@ func TestScan(t *testing.T) {
},
{
name: "Valid input with commas in the selector",
input: []byte(fmt.Sprintf("(%s,%s,repository,\"repository.properties['github/primary_language'] in ['TypeScript', 'Go']\",\"comment1\")", selectorId, profileId)),
input: []byte(fmt.Sprintf(`(%s,%s,repository,"repository.properties['github/primary_language'] in ['TypeScript', 'Go']","comment1")`, selectorId, profileId)),
expected: ProfileSelector{
ID: selectorId,
ProfileID: profileId,
Expand All @@ -66,7 +66,7 @@ func TestScan(t *testing.T) {
},
{
name: "Comment includes uneven quotes",
input: []byte(fmt.Sprintf("(%s,%s,repository,\"repository.name == foo\",\"\"comment1\")", selectorId, profileId)),
input: []byte(fmt.Sprintf(`(%s,%s,repository,"repository.name == foo",""comment1")`, selectorId, profileId)),
expected: ProfileSelector{
ID: selectorId,
ProfileID: profileId,
Expand Down

0 comments on commit 161cf63

Please sign in to comment.