diff options
| author | Manuel Palenzuela Merino <[email protected]> | 2024-12-05 11:07:35 +0100 |
|---|---|---|
| committer | Manuel Palenzuela Merino <[email protected]> | 2024-12-05 11:08:17 +0100 |
| commit | ee3c0aa3d71a857ae7fb60f1b98cf129ee6ad71d (patch) | |
| tree | 8aeaa3b76be6cdcf326acf3627b3d283a8b2c372 /main/additions | |
| parent | Update README.md (diff) | |
| download | test-repo-ee3c0aa3d71a857ae7fb60f1b98cf129ee6ad71d.tar.gz test-repo-ee3c0aa3d71a857ae7fb60f1b98cf129ee6ad71d.tar.bz2 test-repo-ee3c0aa3d71a857ae7fb60f1b98cf129ee6ad71d.zip | |
Add tests
Diffstat (limited to 'main/additions')
| -rw-r--r-- | main/additions/additions-test.xml | 2 | ||||
| -rw-r--r-- | main/additions/additions.go | 11 | ||||
| -rw-r--r-- | main/additions/additions_test.go | 29 |
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) + } +} |