commit aa8ec804e970fa132fb2a980a609edcd532dc568 Author: vinchent Date: Tue Sep 10 11:06:51 2024 +0200 first test for hello world diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..6e11867 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module hello + +go 1.22.5 diff --git a/hello.go b/hello.go new file mode 100644 index 0000000..68151e9 --- /dev/null +++ b/hello.go @@ -0,0 +1,11 @@ +package main + +import "fmt" + +func Hello() string { + return "Hello world" +} + +func main() { + fmt.Println(Hello()) +} diff --git a/hello_test.go b/hello_test.go new file mode 100644 index 0000000..ca1b6cd --- /dev/null +++ b/hello_test.go @@ -0,0 +1,11 @@ +package main + +import "testing" + +func TestHello(t *testing.T) { + got := Hello() + exp := "Hello world" + if got != exp { + t.Errorf("got %q expected %q", got, exp) + } +}