Skip to content

Commit

Permalink
Split unit and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotchance committed Apr 22, 2017
1 parent d9f28f5 commit f20e2a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ before_install:
script:
- . ./.travis.gofmt.sh

# Run the unit tests first
- |
set -e
echo "" > coverage.txt
go test -race -coverprofile=profile.out -coverpkg ./...
go test -tags=integration -race -coverprofile=profile.out -coverpkg ./...
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,24 @@ tree is a semi-intelligent way and producing Go. Easy, right!?

# Testing

Testing is done with a set of integrations tests in the form of complete C
programs that can be found in the
By default only unit tests are run with `go test`. You can also include the
integration tests:

```bash
go test -tags=integration ./...
```

Integration tests in the form of complete C programs that can be found in the
[tests](https://github.com/elliotchance/c2go/tree/master/tests) directory.

For each of those files:
Integration tests work like this:

1. Clang compiles the C to a binary as normal.
2. c2go converts the C file to Go.
3. The Go is built to produce another binary.
4. Both binaries are executed and the output is compared. All C files will
contain some output so the results can be verified.

The test suite is run with `go test`.

# Contributing

Contributing is done with pull requests. There is no help that is too small! :)
Expand Down
2 changes: 2 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build integration

package main

import (
Expand Down

0 comments on commit f20e2a2

Please sign in to comment.