Results for “Testing & reusable patterns”
Small, practical examples. Search by task or narrow things down below.
Check a function with table-driven cases
Check a function with table-driven cases using a complete Go program with explicit sample inputs.
Go✓ Tested
Check whether bytes contain valid JSON
Check whether bytes contain valid JSON using a complete Go program with explicit sample inputs.
Go✓ Tested
Clamp a value to an allowed interval
Clamp a value to an allowed interval using a complete Go program with explicit sample inputs.
Go✓ Tested
Compare floats within a tolerance
Compare floats within a tolerance using a complete Go program with explicit sample inputs.
Go✓ Tested
Compare two byte buffers
Compare two byte buffers using a complete Go program with explicit sample inputs.
Go✓ Tested
Display untrusted-looking text without HTML execution
Display untrusted-looking text without HTML execution with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Distinguish end-of-input from other errors
Distinguish end-of-input from other errors using a complete Go program with explicit sample inputs.
Go✓ Tested
Expose a disclosure’s expanded state
Expose a disclosure’s expanded state with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Group related controls with a fieldset and legend
Group related controls with a fieldset and legend with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Keep a secondary button from submitting a form
Keep a secondary button from submitting a form with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Limit the bytes read from a stream
Limit the bytes read from a stream using a complete Go program with explicit sample inputs.
Go✓ Tested
Preserve input state when tracked records reorder
Preserve input state when tracked records reorder with a standalone Angular component and explicit browser behavior.
Angular✓ Tested