diff options
author | Russ Cox <rsc@golang.org> | 2017-11-15 21:14:21 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-11-16 17:19:19 +0000 |
commit | 62dc3c3f0dc340ad98f737542523c15ee32d671d (patch) | |
tree | e76371a1da599d3c2229dff8671448f5bcd6b9e0 /misc/swig | |
parent | 7cddd39f966c4e3a755a8447c618965479431405 (diff) | |
download | go-62dc3c3f0dc340ad98f737542523c15ee32d671d.tar.gz go-62dc3c3f0dc340ad98f737542523c15ee32d671d.zip |
cmd/go: fix swig support and run swig tests during run.bash
(The tests only run when swig is already installed on the local system.)
Change-Id: I172d106a68cfc746a1058f5a4bcf6761bab88912
Reviewed-on: https://go-review.googlesource.com/78175
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'misc/swig')
-rw-r--r-- | misc/swig/stdio/file.go | 15 | ||||
-rw-r--r-- | misc/swig/stdio/file_test.go | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/misc/swig/stdio/file.go b/misc/swig/stdio/file.go new file mode 100644 index 0000000000..a582f776f6 --- /dev/null +++ b/misc/swig/stdio/file.go @@ -0,0 +1,15 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file is here just to cause problems. +// file.swig turns into a file also named file.go. +// Make sure cmd/go keeps them separate +// when both are passed to cgo. + +package file + +//int F(void) { return 1; } +import "C" + +func F() int { return int(C.F()) } diff --git a/misc/swig/stdio/file_test.go b/misc/swig/stdio/file_test.go index b1a520e6bc..aea92aafd5 100644 --- a/misc/swig/stdio/file_test.go +++ b/misc/swig/stdio/file_test.go @@ -20,3 +20,9 @@ func TestRead(t *testing.T) { t.Error("fclose failed") } } + +func TestF(t *testing.T) { + if x := F(); x != 1 { + t.Fatalf("x = %d, want 1", x) + } +} |