From aa8ec804e970fa132fb2a980a609edcd532dc568 Mon Sep 17 00:00:00 2001 From: vinchent Date: Tue, 10 Sep 2024 11:06:51 +0200 Subject: [PATCH] first test for hello world --- go.mod | 3 +++ hello.go | 11 +++++++++++ hello_test.go | 11 +++++++++++ 3 files changed, 25 insertions(+) create mode 100644 go.mod create mode 100644 hello.go create mode 100644 hello_test.go 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) + } +}