first test for hello world

This commit is contained in:
vinchent 2024-09-10 11:06:51 +02:00
commit aa8ec804e9
3 changed files with 25 additions and 0 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module hello
go 1.22.5

11
hello.go Normal file
View File

@ -0,0 +1,11 @@
package main
import "fmt"
func Hello() string {
return "Hello world"
}
func main() {
fmt.Println(Hello())
}

11
hello_test.go Normal file
View File

@ -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)
}
}