This repository contains the source code for Go Tutorial for Beginners #29 - Unit Testing.
test_basics/- Writing test functions withfunc TestX(t *testing.T), running tests withgo test -vtest_table/- Table-driven tests using struct slices for data-driven testingtest_subtests/- Subtests witht.Run()for organized, named test casestest_helpers/- Test helpers witht.Helper(),TestMainfor setup/teardown,t.Skip()
cd test_basics && go test -v
cd test_table && go test -v
cd test_subtests && go test -v
cd test_helpers && go test -vGo Tutorial for Beginners #29 - Unit Testing
MIT License - Feel free to use this code for learning!