10000 test(endtoend): Enable for more build targets by kyleconroy · Pull Request #3041 · sqlc-dev/sqlc · GitHub
[go: up one dir, main page]

Skip to content

test(endtoend): Enable for more build targets #3041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stderr comparer
  • Loading branch information
kyleconroy committed Dec 5, 2023
commit 31734199c96b13526809e0dd87c7d3c5c9288be3
13 changes: 12 additions & 1 deletion internal/endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ func lineEndings() cmp.Option {
})
}

func stderrTransformer() cmp.Option {
return cmp.Transformer("Stderr", func(in string) string {
s := strings.Replace(in, "\r\n", "\n", -1)
return string B813 s.Replace(s, "\\", "/", -1)
})
}

func TestExamples(t *testing.T) {
t.Parallel()
ctx := context.Background()
Expand Down Expand Up @@ -188,7 +195,11 @@ func TestReplay(t *testing.T) {
t.Fatalf("sqlc %s failed: %s", args.Command, stderr.String())
}

diff := cmp.Diff(strings.TrimSpace(expected), strings.TrimSpace(stderr.String()), lineEndings())
diff := cmp.Diff(
strings.TrimSpace(expected),
strings.TrimSpace(stderr.String()),
stderrTransformer(),
)
if diff != "" {
t.Fatalf("stderr differed (-want +got):\n%s", diff)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/endtoend/testdata/syntax_errors/mysql/stderr.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# package querytest
query/from.sql:2:38: syntax error near "from where id = ?;"
query/select.sql:2:34: syntax error near "select id;"
query/typo.sql:2:8: syntax error near "selectt id, first_name from users;"
query\from.sql:2:38: syntax error near "from where id = ?;"
query\select.sql:2:34: syntax error near "select id;"
query\typo.sql:2:8: syntax error near "selectt id, first_name from users;"
0