summaryrefslogtreecommitdiff
path: root/misc/cgo/test/issue5548.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-05 14:59:09 -0400
committerRuss Cox <rsc@golang.org>2014-09-05 14:59:09 -0400
commitafde047b8fdb004d86026261af9e8f11c9180a8a (patch)
tree2c436f82494dbee4d08a081e72e697897e3be876 /misc/cgo/test/issue5548.go
parente008530606766d3b43ddddaf3b40c062dd7dd02c (diff)
downloadgo-afde047b8fdb004d86026261af9e8f11c9180a8a.tar.gz
misc/cgo/test: make issue5548 test pickier
If there is doubt about passing arguments correctly (as there is in this test), there should be doubt about getting the results back intact too. Using 0 and 1 (especially 0 for success) makes it easy to get a PASS accidentally when the return value is not actually being propagated. Use less common values. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://codereview.appspot.com/141110043
Diffstat (limited to 'misc/cgo/test/issue5548.go')
-rw-r--r--misc/cgo/test/issue5548.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/misc/cgo/test/issue5548.go b/misc/cgo/test/issue5548.go
index b41f46562..c879f2ae9 100644
--- a/misc/cgo/test/issue5548.go
+++ b/misc/cgo/test/issue5548.go
@@ -14,13 +14,14 @@ import "C"
//export issue5548FromC
func issue5548FromC(s string, i int) int {
if len(s) == 4 && s == "test" && i == 42 {
- return 1
+ return 12345
}
- return 0
+ println("got", len(s), i)
+ return 9876
}
func test5548(t *testing.T) {
- if C.issue5548_in_c() == 0 {
- t.Fail()
+ if x := C.issue5548_in_c(); x != 12345 {
+ t.Errorf("issue5548_in_c = %d, want %d", x, 12345)
}
}