When adding functionality or fixing bugs, always add new test functions rather than modifying existing ones to preserve test coverage. Ensure comprehensive testing by including edge cases, error conditions, and assertions for all public functions. Use meaningful, non-default values in tests to improve sensitivity to regressions.
When adding functionality or fixing bugs, always add new test functions rather than modifying existing ones to preserve test coverage. Ensure comprehensive testing by including edge cases, error conditions, and assertions for all public functions. Use meaningful, non-default values in tests to improve sensitivity to regressions.
Key practices:
Example:
// Good: Adding new test function with comprehensive coverage
fn test_new_feature_success_case() {
result := my_function(42) // Use meaningful non-zero value
assert result == expected_value
}
fn test_new_feature_error_case() {
if _ := my_function(-1) {
assert false
} else {
assert true
}
}
// Avoid: Modifying existing test functions or using only default values
This approach maintains existing test coverage while ensuring new functionality is thoroughly validated, making code reviews easier and preventing regressions.
Enter the URL of a public GitHub repository