Curriculum Idioms & ecosystem Testing
Testing
Go has a testing package in the standard library. Tests live next to code in _test.go files. The pattern is table-driven: a slice of (name, input, want) tuples plus t.Run(name, ...) for subtests. No assertion library required — if got != want { t.Errorf(...) } is the whole vocabulary.
9 ready
01
pick onePick the file naming convention that the Go toolchain
02
pick onePick the IDIOMATIC signature for a top-level Go test
03
pick onePick the IDIOMATIC failure-reporting line inside a Go
04
fill blanksType the prefix that every top-level test function name
05
fill blanks Type the method on *testing.T that reports a failure
06
type one line Yaegi can't import the testing package, so this exercise
07
type one line Write the t.Errorf call inside an if-block that triggers
08
write a programDemonstrate the table-driven test pattern — Go's
09
write a programTheme 7.4 capstone — table-driven test with a deliberate