From 21ffa453efbbf0fbc22acc9209239c0a23ac6450 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Mon, 24 Feb 2020 11:27:50 -0800 Subject: [PATCH 1/2] README: Add section on running tests --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 78e6e8f0f7..fcd75111ff 100644 --- a/README.md +++ b/README.md @@ -438,6 +438,35 @@ sponsor](https://github.com/sponsors/kyleconroy) today. Sponsors receive priority support via the sqlc Slack organization. +## Development + +### Running Tests + +To run the tests, include the `exp` tag. Without this tag, a few tests will +fail. + +``` +go test --tags=exp ./... +``` + +To run the tests in the examples folder, a running PostgreSQL instance is +required. The tests use the following environment variables to connect to the +database: + +``` +Variable Default Value +------------------------- +PG_HOST 127.0.0.1 +PG_PORT 5432 +PG_USER postgres +PG_PASSWORD mysecretpassword +PG_DATABASE dinotest +``` + +``` +go test --tags=examples,exp ./... +``` + ## Acknowledgements sqlc was inspired by [PugSQL](https://pugsql.org/) and From 9e9dd68a1f052886d3cd522220f63537d5907866 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Mon, 24 Feb 2020 11:40:56 -0800 Subject: [PATCH 2/2] Add more test help --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index fcd75111ff..59ca09174a 100644 --- a/README.md +++ b/README.md @@ -440,6 +440,14 @@ Sponsors receive priority support via the sqlc Slack organization. ## Development +### Building + +For local development, install `sqlc` under an alias. We suggest `sqlc-dev`. + +``` +go build -o ~/go/bin/sqlc-dev ./cmd/sqlc +``` + ### Running Tests To run the tests, include the `exp` tag. Without this tag, a few tests will @@ -467,6 +475,16 @@ PG_DATABASE dinotest go test --tags=examples,exp ./... ``` +### Regenerate exepected test output + +If you need to update a large number of expexted test output in the +`internal/endtoend/testdata` directory, run the `regenerate.sh` script. + +``` +cd internal/endtoend +./regenerate.sh +``` + ## Acknowledgements sqlc was inspired by [PugSQL](https://pugsql.org/) and