FIND YOUR NEXT FEW LINES

Results for “Deferred work & queues”

Small, practical examples. Search by task or narrow things down below.

550 snippets foundClear filters
RustTesting & reusable patterns

Check a deterministic result with an assertion

Check a deterministic result with an assertion in a complete Rust program using the standard library.

Rust✓ Tested
GoTesting & reusable helpers

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
Bash ScriptsDiagnostics & defensive scripting

Check a script’s syntax without executing its body

Bash Scripts: bash -n parses commands but does not run ordinary script statements.

Bash Scripts✓ Tested
Bash ScriptsArray operations

Check exact array membership

Bash Scripts: Compare each element literally instead of searching a concatenated string.

Bash Scripts✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check for an installed command

Bash Scripts: command -v checks command resolution without assuming a specific installation path.

Bash Scripts✓ Tested
Bash ScriptsFiles & reliability

Check that a file is present and nonempty

Test file content availability before reading it.

file check✓ Tested
RustNumbers & durations

Check whether a floating-point value is finite

Check whether a floating-point value is finite in a complete Rust program using the standard library.

Rust✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check whether a function has been defined

Bash Scripts: declare -F tests a function name without executing it.

Bash Scripts✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check whether a variable exists under nounset

Bash Scripts: The plus expansion distinguishes an unset variable without reading its missing value.

Bash Scripts✓ Tested
GoTesting & reusable helpers

Check whether bytes contain valid JSON

Check whether bytes contain valid JSON using a complete Go program with explicit sample inputs.

Go✓ Tested
Bash ScriptsLoops & decisions

Check whether input is a nonnegative integer

Reject empty input and nonnumeric characters before arithmetic.

validation✓ Tested
GoGetting Started

Choose a branch with if and else

Choose a branch with if and else using a complete Go program with explicit sample inputs.

Go✓ Tested