summaryrefslogtreecommitdiffstats
path: root/src/cmd/cover/testdata/pkgcfg
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:19:13 +0000
commitccd992355df7192993c666236047820244914598 (patch)
treef00fea65147227b7743083c6148396f74cd66935 /src/cmd/cover/testdata/pkgcfg
parentInitial commit. (diff)
downloadgolang-1.21-ccd992355df7192993c666236047820244914598.tar.xz
golang-1.21-ccd992355df7192993c666236047820244914598.zip
Adding upstream version 1.21.8.upstream/1.21.8
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/cover/testdata/pkgcfg')
-rw-r--r--src/cmd/cover/testdata/pkgcfg/a/a.go28
-rw-r--r--src/cmd/cover/testdata/pkgcfg/a/a2.go8
-rw-r--r--src/cmd/cover/testdata/pkgcfg/a/a_test.go14
-rw-r--r--src/cmd/cover/testdata/pkgcfg/b/b.go10
-rw-r--r--src/cmd/cover/testdata/pkgcfg/b/b_test.go9
-rw-r--r--src/cmd/cover/testdata/pkgcfg/main/main.go15
6 files changed, 84 insertions, 0 deletions
diff --git a/src/cmd/cover/testdata/pkgcfg/a/a.go b/src/cmd/cover/testdata/pkgcfg/a/a.go
new file mode 100644
index 0000000..44c380b
--- /dev/null
+++ b/src/cmd/cover/testdata/pkgcfg/a/a.go
@@ -0,0 +1,28 @@
+package a
+
+type Atyp int
+
+func (ap *Atyp) Set(q int) {
+ *ap = Atyp(q)
+}
+
+func (ap Atyp) Get() int {
+ inter := func(q Atyp) int {
+ return int(q)
+ }
+ return inter(ap)
+}
+
+var afunc = func(x int) int {
+ return x + 1
+}
+var Avar = afunc(42)
+
+func A(x int) int {
+ if x == 0 {
+ return 22
+ } else if x == 1 {
+ return 33
+ }
+ return 44
+}
diff --git a/src/cmd/cover/testdata/pkgcfg/a/a2.go b/src/cmd/cover/testdata/pkgcfg/a/a2.go
new file mode 100644
index 0000000..e6b2fc1
--- /dev/null
+++ b/src/cmd/cover/testdata/pkgcfg/a/a2.go
@@ -0,0 +1,8 @@
+package a
+
+func A2() {
+ {
+ }
+ {
+ }
+}
diff --git a/src/cmd/cover/testdata/pkgcfg/a/a_test.go b/src/cmd/cover/testdata/pkgcfg/a/a_test.go
new file mode 100644
index 0000000..a1608e0
--- /dev/null
+++ b/src/cmd/cover/testdata/pkgcfg/a/a_test.go
@@ -0,0 +1,14 @@
+package a_test
+
+import (
+ "cfg/a"
+ "testing"
+)
+
+func TestA(t *testing.T) {
+ a.A(0)
+ var aat a.Atyp
+ at := &aat
+ at.Set(42)
+ println(at.Get())
+}
diff --git a/src/cmd/cover/testdata/pkgcfg/b/b.go b/src/cmd/cover/testdata/pkgcfg/b/b.go
new file mode 100644
index 0000000..9e330ee
--- /dev/null
+++ b/src/cmd/cover/testdata/pkgcfg/b/b.go
@@ -0,0 +1,10 @@
+package b
+
+func B(x int) int {
+ if x == 0 {
+ return 22
+ } else if x == 1 {
+ return 33
+ }
+ return 44
+}
diff --git a/src/cmd/cover/testdata/pkgcfg/b/b_test.go b/src/cmd/cover/testdata/pkgcfg/b/b_test.go
new file mode 100644
index 0000000..7bdb73b
--- /dev/null
+++ b/src/cmd/cover/testdata/pkgcfg/b/b_test.go
@@ -0,0 +1,9 @@
+package b
+
+import "testing"
+
+func TestB(t *testing.T) {
+ B(0)
+ B(1)
+ B(2)
+}
diff --git a/src/cmd/cover/testdata/pkgcfg/main/main.go b/src/cmd/cover/testdata/pkgcfg/main/main.go
new file mode 100644
index 0000000..a908931
--- /dev/null
+++ b/src/cmd/cover/testdata/pkgcfg/main/main.go
@@ -0,0 +1,15 @@
+package main
+
+import (
+ "cfg/a"
+ "cfg/b"
+)
+
+func main() {
+ a.A(2)
+ a.A(1)
+ a.A(0)
+ b.B(1)
+ b.B(0)
+ println("done")
+}