This repository contains examples of use cases on how to use TDD in Go. It is based on the quii GitBook website.
Run a specific test:
$ go test -run <test_name> # example: go test -run TestHello
Run the tests of a specific directory:
$ cd <directory> # example: cd hello_world
$ go test
Run the tests of a specific directory and show the coverage:
$ cd <directory> # example: cd hello_world
$ go test -cover
Run the main function of a specific file:
$ go run <file_name>.go
Run a benchmark test for a specific directory
$ cd <directory> # example: cd hello_world
$ go test -bench=.
Run all the tests of the project:
$ go test ./...