Improves the test coverage of the project and adds examples for coverage reports. - Increases the test coverage of the `cmd/trix` package from 67.7% to 78.1%. - Increases the test coverage of the `pkg/crypt` package from 96.2% to 98.7%. - Adds tests for the `examples` to ensure they run without errors. - Adds a new example that demonstrates how to generate and interpret a coverage report.
21 lines
608 B
Go
21 lines
608 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
fmt.Println("--- Test Coverage Demo ---")
|
|
fmt.Println("")
|
|
fmt.Println("This example demonstrates how to generate and interpret a test coverage report.")
|
|
fmt.Println("")
|
|
fmt.Println("1. Generate a coverage profile:")
|
|
fmt.Println(" go test ./... -coverprofile=coverage.out")
|
|
fmt.Println("")
|
|
fmt.Println("2. View the coverage report in your browser:")
|
|
fmt.Println(" go tool cover -html=coverage.out")
|
|
fmt.Println("")
|
|
fmt.Println("3. View the coverage report in your terminal:")
|
|
fmt.Println(" go tool cover -func=coverage.out")
|
|
fmt.Println("")
|
|
}
|