From 161cf634802915fc4ce421fad50609c5fa97b450 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 18 Sep 2024 22:17:46 +0200 Subject: [PATCH] Use backticks to avoid escaping quotes --- internal/db/profile_selector_scan_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/db/profile_selector_scan_test.go b/internal/db/profile_selector_scan_test.go index ad5554455e..21a9a1ae77 100644 --- a/internal/db/profile_selector_scan_test.go +++ b/internal/db/profile_selector_scan_test.go @@ -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, @@ -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, @@ -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,