Add some more tests for config validation, and fix some gaps (#274)

I set these tests up in #270, but I realized there's a lot more we could
test unrelated to that PR. In this commit I add some more tests. They're
not really exhaustive yet, but they did catch a few bugs, which I fixed:
- we weren't validating the package-name if you do set it (only if we
guess it)
- If you omitted `generated`, you would try to write generated code to
the directory containing `genqlient.yaml`, which makes no sense; now we
default to `generated.go`. In the real world it's probably good to set
explicitly, but it's actually very convenient in tests that we don't
have to, and maybe in small projects too.
This commit is contained in:
Ben Kraft
2023-05-07 17:52:08 -07:00
committed by GitHub
parent ff790e1c06
commit 65d934a705
18 changed files with 141 additions and 30 deletions
+1 -2
View File
@@ -26,7 +26,7 @@ operations:
- "pkg/*.go"
# The filename to which to write the generated code, relative to
# genqlient.yaml.
# genqlient.yaml. Default: generated.go.
generated: generated/genqlient.go
# The package name for the output code; defaults to the directory name of
@@ -77,7 +77,6 @@ context_type: context.Context
# without making a query.
client_getter: "github.com/you/yourpkg.GetClient"
# If set, fields with a struct type will default to having
# the "pointer: true, omitempty: true" flag.
#