開発環境
- macOS Mojave - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Visual Studio Code (Text Editor)
- Go (プログラミング言語)
Head First Go (Jay McGavren(著)、O'Reilly Media)のChapter 3(call me - Functions)、Code Magnets(106)の解答を求めてみる。
コード
sample3_test.go
package main
import "testing"
func Test(t *testing.T) {
var myInt int
var myIntPointer *int
myInt = 42
myIntPointer = &myInt
got := *myIntPointer
want := 42
if got != want {
t.Errorf("%d, %d", got, want)
}
}
sample3.go
package main
func main() {}
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal)
$ go test PASS ok _/.../Head_First_Go/ch3/sample3 0.005s $
0 コメント:
コメントを投稿