Understand the design philosophy of be
mainThe be package is designed to be a minimal, opinionated alternative to testify or is. Key design principles include:
- Minimal API: Only three functions:
Equal,Err, andTrue. - No Custom Messages: The package does not support custom error messages for assertions; it relies on the test runner's line numbers to identify failures.
- Non-terminating Failures: Most assertions do not stop the test execution immediately, allowing you to see multiple failures at once. The only exception is
be.Err(t, err, nil)failing (when an unexpected error occurs), which terminates the test to prevent subsequent panics. - Natural Parameter Order: Uses
(got, want)rather than(want, got)to follow natural language patterns (e.g., "balance is 100"). - Flexible Error Handling: A single
Errfunction replaces the need forErrorIs,ErrorAs,NoError, etc.