Skip to content

Commit 7657fb7

Browse files
authored
README: Add section on running tests (#357)
* README: Add section on running tests * Add more test help
1 parent d2823f5 commit 7657fb7

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,53 @@ sponsor](https://github.com/sponsors/kyleconroy) today.
438438

439439
Sponsors receive priority support via the sqlc Slack organization.
440440

441+
## Development
442+
443+
### Building
444+
445+
For local development, install `sqlc` under an alias. We suggest `sqlc-dev`.
446+
447+
```
448+
go build -o ~/go/bin/sqlc-dev ./cmd/sqlc
449+
```
450+
451+
### Running Tests
452+
453+
To run the tests, include the `exp` tag. Without this tag, a few tests will
454+
fail.
455+
456+
```
457+
go test --tags=exp ./...
458+
```
459+
460+
To run the tests in the examples folder, a running PostgreSQL instance is
461+
required. The tests use the following environment variables to connect to the
462+
database:
463+
464+
```
465+
Variable Default Value
466+
-------------------------
467+
PG_HOST 127.0.0.1
468+
PG_PORT 5432
469+
PG_USER postgres
470+
PG_PASSWORD mysecretpassword
471+
PG_DATABASE dinotest
472+
```
473+
474+
```
475+
go test --tags=examples,exp ./...
476+
```
477+
478+
### Regenerate exepected test output
479+
480+
If you need to update a large number of expexted test output in the
481+
`internal/endtoend/testdata` directory, run the `regenerate.sh` script.
482+
483+
```
484+
cd internal/endtoend
485+
./regenerate.sh
486+
```
487+
441488
## Acknowledgements
442489

443490
sqlc was inspired by [PugSQL](https://pugsql.org/) and

0 commit comments

Comments
 (0)