hello world
This commit is contained in:
parent
0cba8bfae5
commit
12b62ccee4
11
main.go
Normal file
11
main.go
Normal file
@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println(sayHi("Mike"))
|
||||
}
|
||||
|
||||
func sayHi(name string) string {
|
||||
return fmt.Sprintf("Hi %s", name)
|
||||
}
|
||||
12
main_test.go
Normal file
12
main_test.go
Normal file
@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSayHi(t *testing.T) {
|
||||
expected := "Hi Testy"
|
||||
greeting := sayHi("Testy")
|
||||
if greeting != expected {
|
||||
t.Errorf("Greeting was incorrect, got: '%s', want: '%s'",
|
||||
greeting, expected)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user