diff --git a/hello/go.mod b/hello/go.mod new file mode 100644 index 0000000..0c111d1 --- /dev/null +++ b/hello/go.mod @@ -0,0 +1,3 @@ +module hello + +go 1.22.1 diff --git a/hello/hello.go b/hello/hello.go new file mode 100644 index 0000000..f6ea0d7 --- /dev/null +++ b/hello/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/hello_test.go b/hello/hello_test.go new file mode 100644 index 0000000..20d88d0 --- /dev/null +++ b/hello/hello_test.go @@ -0,0 +1,12 @@ +package main + +import "testing" + +func TestHello(t *testing.T) { + given := Hello() + expected := "Hello, world!" + + if given != expected { + t.Errorf("given: %v, expected: %v", given, expected) + } +}