diff libgo/misc/cgo/test/issue18720.go @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line diff
--- a/libgo/misc/cgo/test/issue18720.go	Fri Oct 27 22:46:09 2017 +0900
+++ b/libgo/misc/cgo/test/issue18720.go	Thu Oct 25 07:37:49 2018 +0900
@@ -12,13 +12,39 @@
 struct foo { char c; };
 #define SIZE_OF(x) sizeof(x)
 #define SIZE_OF_FOO SIZE_OF(struct foo)
+#define VAR1 VAR
+#define VAR var
+int var = 5;
+
+#define ADDR &var
+
+#define CALL fn()
+int fn(void) {
+	return ++var;
+}
 */
 import "C"
 import "testing"
 
 func test18720(t *testing.T) {
-	if C.HELLO_WORLD != "hello\000world" {
-		t.Fatalf(`expected "hello\000world", but got %q`, C.HELLO_WORLD)
+	if got, want := C.HELLO_WORLD, "hello\000world"; got != want {
+		t.Errorf("C.HELLO_WORLD == %q, expected %q", got, want)
+	}
+
+	if got, want := C.VAR1, C.int(5); got != want {
+		t.Errorf("C.VAR1 == %v, expected %v", got, want)
+	}
+
+	if got, want := *C.ADDR, C.int(5); got != want {
+		t.Errorf("*C.ADDR == %v, expected %v", got, want)
+	}
+
+	if got, want := C.CALL, C.int(6); got != want {
+		t.Errorf("C.CALL == %v, expected %v", got, want)
+	}
+
+	if got, want := C.CALL, C.int(7); got != want {
+		t.Errorf("C.CALL == %v, expected %v", got, want)
 	}
 
 	// Issue 20125.