--- /dev/null
+// Copyright 2015 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.
+
+// issue 13635: used to output error about C.unsignedchar.
+// This test tests all such types.
+
+package pkg
+
+import "C"
+
+func main() {
+ var (
+ _ C.uchar = "uc" // ERROR HERE
+ _ C.schar = "sc" // ERROR HERE
+ _ C.ushort = "us" // ERROR HERE
+ _ C.uint = "ui" // ERROR HERE
+ _ C.ulong = "ul" // ERROR HERE
+ _ C.longlong = "ll" // ERROR HERE
+ _ C.ulonglong = "ull" // ERROR HERE
+ _ C.complexfloat = "cf" // ERROR HERE
+ _ C.complexdouble = "cd" // ERROR HERE
+ )
+}
expect() {
file=$1
- error=$2
+ shift
if go build $file >errs 2>&1; then
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected cgo to fail but it succeeded
exit 1
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output but saw none
exit 1
fi
- if ! fgrep $error errs >/dev/null 2>&1; then
- echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output to contain \"$error\" but saw:
- cat 1>&2 errs
- exit 1
- fi
+ for error; do
+ if ! fgrep $error errs >/dev/null 2>&1; then
+ echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output to contain \"$error\" but saw:
+ cat 1>&2 errs
+ exit 1
+ fi
+ done
}
check err1.go
check issue11097b.go
expect issue13129.go C.ushort
check issue13423.go
+expect issue13635.go C.uchar C.schar C.ushort C.uint C.ulong C.longlong C.ulonglong C.complexfloat C.complexdouble
if ! go run ptr.go; then
exit 1
"long long int": "longlong",
"long long unsigned int": "ulonglong",
"signed char": "schar",
+ "unsigned char": "uchar",
}
const signedDelta = 64