From 311656f092a8ccea6b8e0a4d27f9e8be63d2fa14 Mon Sep 17 00:00:00 2001 From: Upamanyu Sharma Date: Sun, 24 Nov 2024 22:10:19 -0500 Subject: [PATCH] Add (failing) globals unittest --- testdata/examples/unittest/globals.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 testdata/examples/unittest/globals.go diff --git a/testdata/examples/unittest/globals.go b/testdata/examples/unittest/globals.go new file mode 100644 index 0000000..33fca6d --- /dev/null +++ b/testdata/examples/unittest/globals.go @@ -0,0 +1,19 @@ +package unittest + +func foo() uint64 { + return 10 +} + +var globalX uint64 = foo() +var globalY string + +func other() { + globalY = "ok" +} + +func bar() { + other() + if x != 10 || globalY != "ok" { + panic("bad") + } +}