-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reproduce build failure for TestMain in black box test
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package add | ||
|
||
func Add(x, y int) int { | ||
return x + y | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package add_test | ||
|
||
import ( | ||
add "github.com/rillig/gobco/testdata/testmaintest" | ||
"os" | ||
"testing" | ||
) | ||
|
||
// The TestMain function is defined in a black box test, thus the suffix | ||
// '_test' in the package name. | ||
|
||
func TestMain(m *testing.M) { | ||
os.Exit(m.Run()) | ||
} | ||
|
||
func TestAdd(t *testing.T) { | ||
have, want := add.Add(1, 2), 3 | ||
if have != want { | ||
t.Errorf("want %d, have %d", want, have) | ||
} | ||
} |