about summary refs log tree commit diff
path: root/main/additions
diff options
context:
space:
mode:
Diffstat (limited to 'main/additions')
-rw-r--r--main/additions/additions-test.xml2
-rw-r--r--main/additions/additions.go11
-rw-r--r--main/additions/additions_test.go29
3 files changed, 42 insertions, 0 deletions
diff --git a/main/additions/additions-test.xml b/main/additions/additions-test.xml
new file mode 100644
index 0000000..ed6f30b
--- /dev/null
+++ b/main/additions/additions-test.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="0" failures="0" errors="1" time="0.546355"></testsuites>
\ No newline at end of file
diff --git a/main/additions/additions.go b/main/additions/additions.go
new file mode 100644
index 0000000..a5170de
--- /dev/null
+++ b/main/additions/additions.go
@@ -0,0 +1,11 @@
+package main
+
+import "fmt"
+
+func main() {
+	fmt.Println(addNumbers(2, 3))
+}
+
+func addNumbers(x int, y int) int {
+	return y + x
+}
diff --git a/main/additions/additions_test.go b/main/additions/additions_test.go
new file mode 100644
index 0000000..d62bc68
--- /dev/null
+++ b/main/additions/additions_test.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+	"os"
+	"testing"
+
+	"ci-visibility-test-github/main/civisibility/integrations/gotesting"
+)
+
+func TestMain(m *testing.M) {
+	// NOTE: This is the only needed thing to enable test visibility instrumentation.
+	os.Exit(gotesting.RunM(m))
+}
+
+func Test_AddNumbers(t *testing.T) {
+	ans := addNumbers(2, 5)
+
+	if ans != 7 {
+		t.Fatal("Expected 7 but instead got ", ans)
+	}
+}
+
+func Test_AddNumbers2(t *testing.T) {
+	ans := addNumbers(7, 5)
+
+	if ans != 12 {
+		t.Fatal("Expected 12 but instead got ", ans)
+	}
+}