Skip to content

README: Add section on running tests #357

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 2 commits into from
Feb 24, 2020
Merged
Changes from all commits
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
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,53 @@ sponsor](https://github.com/sponsors/kyleconroy) today.

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
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 ./...
```

### 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
Expand Down