diff options
author | Jason Karns <jason@karns.name> | 2018-11-27 19:14:03 +0300 |
---|---|---|
committer | Jason Karns <jason@karns.name> | 2018-11-27 19:14:03 +0300 |
commit | 4dfe724a2e65102261697b29d3e6a7345ee6e85d (patch) | |
tree | 4529dca1791a883328b06f951fbbb7ba1348fe40 | |
parent | dce8e18f7828549eb7c53da3ef8f1c480263687a (diff) |
Better assertion name
-rwxr-xr-x | test/50-assert-11-assert.bats | 2 | ||||
-rwxr-xr-x | test/50-assert-12-assert_equal.bats | 2 | ||||
-rwxr-xr-x | test/50-assert-13-assert_success.bats | 2 | ||||
-rwxr-xr-x | test/50-assert-14-assert_failure.bats | 4 | ||||
-rwxr-xr-x | test/50-assert-15-assert_output.bats | 20 | ||||
-rwxr-xr-x | test/50-assert-16-refute_output.bats | 18 | ||||
-rwxr-xr-x | test/50-assert-17-assert_line.bats | 24 | ||||
-rwxr-xr-x | test/50-assert-18-refute_line.bats | 28 | ||||
-rwxr-xr-x | test/50-assert-19-refute.bats | 2 | ||||
-rw-r--r-- | test/test_helper.bash | 2 |
10 files changed, 52 insertions, 52 deletions
diff --git a/test/50-assert-11-assert.bats b/test/50-assert-11-assert.bats index cea76c5..2ed7d5d 100755 --- a/test/50-assert-11-assert.bats +++ b/test/50-assert-11-assert.bats @@ -4,7 +4,7 @@ load test_helper @test 'assert() <expression>: returns 0 if <expression> evaluates to TRUE' { run assert true - assert_quiet_exit + assert_test_pass } @test 'assert() <expression>: returns 1 and displays <expression> if it evaluates to FALSE' { diff --git a/test/50-assert-12-assert_equal.bats b/test/50-assert-12-assert_equal.bats index 0c865f0..af10bfa 100755 --- a/test/50-assert-12-assert_equal.bats +++ b/test/50-assert-12-assert_equal.bats @@ -4,7 +4,7 @@ load test_helper @test 'assert_equal() <actual> <expected>: returns 0 if <actual> equals <expected>' { run assert_equal 'a' 'a' - assert_quiet_exit + assert_test_pass } @test 'assert_equal() <actual> <expected>: returns 1 and displays details if <actual> does not equal <expected>' { diff --git a/test/50-assert-13-assert_success.bats b/test/50-assert-13-assert_success.bats index bf6c053..65c23f5 100755 --- a/test/50-assert-13-assert_success.bats +++ b/test/50-assert-13-assert_success.bats @@ -5,7 +5,7 @@ load test_helper @test "assert_success(): returns 0 if \`\$status' is 0" { run true run assert_success - assert_quiet_exit + assert_test_pass } @test "assert_success(): returns 1 and displays details if \`\$status' is not 0" { diff --git a/test/50-assert-14-assert_failure.bats b/test/50-assert-14-assert_failure.bats index 14f4d1e..21b9999 100755 --- a/test/50-assert-14-assert_failure.bats +++ b/test/50-assert-14-assert_failure.bats @@ -5,7 +5,7 @@ load test_helper @test "assert_failure(): returns 0 if \`\$status' is not 0" { run false run assert_failure - assert_quiet_exit + assert_test_pass } @test "assert_failure(): returns 1 and displays details if \`\$status' is 0" { @@ -35,7 +35,7 @@ load test_helper @test "assert_failure() <status>: returns 0 if \`\$status' equals <status>" { run bash -c 'exit 1' run assert_failure 1 - assert_quiet_exit + assert_test_pass } @test "assert_failure() <status>: returns 1 and displays details if \`\$status' does not equal <status>" { diff --git a/test/50-assert-15-assert_output.bats b/test/50-assert-15-assert_output.bats index 0779a1c..19ad6a5 100755 --- a/test/50-assert-15-assert_output.bats +++ b/test/50-assert-15-assert_output.bats @@ -10,7 +10,7 @@ load test_helper @test "assert_output() <expected>: returns 0 if <expected> equals \`\$output'" { run echo 'a' run assert_output 'a' - assert_quiet_exit + assert_test_pass } @test "assert_output() <expected>: returns 1 and displays details if <expected> does not equal \`\$output'" { @@ -29,7 +29,7 @@ load test_helper run assert_output - <<STDIN a STDIN - assert_quiet_exit + assert_test_pass } @test 'assert_output() --stdin : reads <expected> from STDIN' { @@ -37,7 +37,7 @@ STDIN run assert_output --stdin <<STDIN a STDIN - assert_quiet_exit + assert_test_pass } # Output formatting @@ -84,20 +84,20 @@ STDIN @test 'assert_output() -p <partial>: enables partial matching' { run echo 'abc' run assert_output -p 'b' - assert_quiet_exit + assert_test_pass } @test 'assert_output() --partial <partial>: enables partial matching' { run echo 'abc' run assert_output --partial 'b' - assert_quiet_exit + assert_test_pass } # Correctness @test "assert_output() --partial <partial>: returns 0 if <partial> is a substring in \`\$output'" { run printf 'a\nb\nc' run assert_output --partial 'b' - assert_quiet_exit + assert_test_pass } @test "assert_output() --partial <partial>: returns 1 and displays details if <partial> is not a substring in \`\$output'" { @@ -148,20 +148,20 @@ STDIN @test 'assert_output() -e <regexp>: enables regular expression matching' { run echo 'abc' run assert_output -e '^a' - assert_quiet_exit + assert_test_pass } @test 'assert_output() --regexp <regexp>: enables regular expression matching' { run echo 'abc' run assert_output --regexp '^a' - assert_quiet_exit + assert_test_pass } # Correctness @test "assert_output() --regexp <regexp>: returns 0 if <regexp> matches \`\$output'" { run printf 'a\nb\nc' run assert_output --regexp '.*b.*' - assert_quiet_exit + assert_test_pass } @test "assert_output() --regexp <regexp>: returns 1 and displays details if <regexp> does not match \`\$output'" { @@ -231,5 +231,5 @@ STDIN @test "assert_output(): \`--' stops parsing options" { run echo '-p' run assert_output -- '-p' - assert_quiet_exit + assert_test_pass } diff --git a/test/50-assert-16-refute_output.bats b/test/50-assert-16-refute_output.bats index a876cc2..6b29ff7 100755 --- a/test/50-assert-16-refute_output.bats +++ b/test/50-assert-16-refute_output.bats @@ -11,7 +11,7 @@ load test_helper @test "refute_output() <unexpected>: returns 0 if <unexpected> does not equal \`\$output'" { run echo 'b' run refute_output 'a' - assert_quiet_exit + assert_test_pass } @test "refute_output() <unexpected>: returns 1 and displays details if <unexpected> equals \`\$output'" { @@ -30,7 +30,7 @@ load test_helper b INPUT - assert_quiet_exit + assert_test_pass } @test 'refute_output() --stdin : reads <unexpected> from STDIN' { @@ -39,7 +39,7 @@ INPUT b INPUT - assert_quiet_exit + assert_test_pass } # Output formatting @@ -59,7 +59,7 @@ INPUT @test 'refute_output() <unexpected>: performs literal matching by default' { run echo 'a' run refute_output '*' - assert_quiet_exit + assert_test_pass } @@ -71,7 +71,7 @@ INPUT test_p_partial () { run echo 'abc' run refute_output "$1" 'd' - assert_quiet_exit + assert_test_pass } @test 'refute_output() -p <partial>: enables partial matching' { @@ -86,7 +86,7 @@ test_p_partial () { @test "refute_output() --partial <partial>: returns 0 if <partial> is not a substring in \`\$output'" { run printf 'a\nb\nc' run refute_output --partial 'd' - assert_quiet_exit + assert_test_pass } @test "refute_output() --partial <partial>: returns 1 and displays details if <partial> is a substring in \`\$output'" { @@ -124,7 +124,7 @@ test_p_partial () { test_r_regexp () { run echo 'abc' run refute_output "$1" '^d' - assert_quiet_exit + assert_test_pass } @test 'refute_output() -e <regexp>: enables regular expression matching' { @@ -139,7 +139,7 @@ test_r_regexp () { @test "refute_output() --regexp <regexp>: returns 0 if <regexp> does not match \`\$output'" { run printf 'a\nb\nc' run refute_output --regexp '.*d.*' - assert_quiet_exit + assert_test_pass } @test "refute_output() --regexp <regexp>: returns 1 and displays details if <regexp> matches \`\$output'" { @@ -195,5 +195,5 @@ test_r_regexp () { @test "refute_output(): \`--' stops parsing options" { run echo '--' run refute_output -- '-p' - assert_quiet_exit + assert_test_pass } diff --git a/test/50-assert-17-assert_line.bats b/test/50-assert-17-assert_line.bats index a57cb7b..0d178dd 100755 --- a/test/50-assert-17-assert_line.bats +++ b/test/50-assert-17-assert_line.bats @@ -15,7 +15,7 @@ load test_helper @test "assert_line() <expected>: returns 0 if <expected> is a line in \`\${lines[@]}'" { run printf 'a\nb\nc' run assert_line 'b' - assert_quiet_exit + assert_test_pass } @test "assert_line() <expected>: returns 1 and displays details if <expected> is not a line in \`\${lines[@]}'" { @@ -59,7 +59,7 @@ load test_helper test_p_partial () { run printf 'a\n_b_\nc' run assert_line "$1" 'b' - assert_quiet_exit + assert_test_pass } @test 'assert_line() -p <partial>: enables partial matching' { @@ -74,7 +74,7 @@ test_p_partial () { @test "assert_line() --partial <partial>: returns 0 if <partial> is a substring in any line in \`\${lines[@]}'" { run printf 'a\n_b_\nc' run assert_line --partial 'b' - assert_quiet_exit + assert_test_pass } @test "assert_line() --partial <partial>: returns 1 and displays details if <partial> is not a substring in any lines in \`\${lines[@]}'" { @@ -111,7 +111,7 @@ test_p_partial () { test_r_regexp () { run printf 'a\n_b_\nc' run assert_line "$1" '^.b' - assert_quiet_exit + assert_test_pass } @test 'assert_line() -e <regexp>: enables regular expression matching' { @@ -126,7 +126,7 @@ test_r_regexp () { @test "assert_line() --regexp <regexp>: returns 0 if <regexp> matches any line in \`\${lines[@]}'" { run printf 'a\n_b_\nc' run assert_line --regexp '^.b' - assert_quiet_exit + assert_test_pass } @test "assert_line() --regexp <regexp>: returns 1 and displays details if <regexp> does not match any lines in \`\${lines[@]}'" { @@ -163,7 +163,7 @@ test_r_regexp () { test_n_index () { run printf 'a\nb\nc' run assert_line "$1" 1 'b' - assert_quiet_exit + assert_test_pass } @test 'assert_line() -n <idx> <expected>: matches against the <idx>-th line only' { @@ -192,7 +192,7 @@ test_n_index () { @test "assert_line() --index <idx> <expected>: returns 0 if <expected> equals \`\${lines[<idx>]}'" { run printf 'a\nb\nc' run assert_line --index 1 'b' - assert_quiet_exit + assert_test_pass } @test "assert_line() --index <idx> <expected>: returns 1 and displays details if <expected> does not equal \`\${lines[<idx>]}'" { @@ -223,7 +223,7 @@ test_n_index () { test_index_p_partial () { run printf 'a\n_b_\nc' run assert_line --index 1 "$1" 'b' - assert_quiet_exit + assert_test_pass } @test 'assert_line() --index <idx> -p <partial>: enables partial matching' { @@ -238,7 +238,7 @@ test_index_p_partial () { @test "assert_line() --index <idx> --partial <partial>: returns 0 if <partial> is a substring in \`\${lines[<idx>]}'" { run printf 'a\n_b_\nc' run assert_line --index 1 --partial 'b' - assert_quiet_exit + assert_test_pass } @test "assert_line() --index <idx> --partial <partial>: returns 1 and displays details if <partial> is not a substring in \`\${lines[<idx>]}'" { @@ -262,7 +262,7 @@ test_index_p_partial () { test_index_r_regexp () { run printf 'a\n_b_\nc' run assert_line --index 1 "$1" '^.b' - assert_quiet_exit + assert_test_pass } @test 'assert_line() --index <idx> -e <regexp>: enables regular expression matching' { @@ -277,7 +277,7 @@ test_index_r_regexp () { @test "assert_line() --index <idx> --regexp <regexp>: returns 0 if <regexp> matches \`\${lines[<idx>]}'" { run printf 'a\n_b_\nc' run assert_line --index 1 --regexp '^.b' - assert_quiet_exit + assert_test_pass } @test "assert_line() --index <idx> --regexp <regexp>: returns 1 and displays details if <regexp> does not match \`\${lines[<idx>]}'" { @@ -318,5 +318,5 @@ test_index_r_regexp () { @test "assert_line(): \`--' stops parsing options" { run printf 'a\n-p\nc' run assert_line -- '-p' - assert_quiet_exit + assert_test_pass } diff --git a/test/50-assert-18-refute_line.bats b/test/50-assert-18-refute_line.bats index a5f3532..5d77066 100755 --- a/test/50-assert-18-refute_line.bats +++ b/test/50-assert-18-refute_line.bats @@ -15,7 +15,7 @@ load test_helper @test "refute_line() <unexpected>: returns 0 if <unexpected> is not a line in \`\${lines[@]}'" { run printf 'a\nb\nc' run refute_line 'd' - assert_quiet_exit + assert_test_pass } @test "refute_line() <unexpected>: returns 1 and displays details if <unexpected> is not a line in \`\${lines[@]}'" { @@ -50,7 +50,7 @@ load test_helper @test 'refute_line() <unexpected>: performs literal matching by default' { run echo 'a' run refute_line '*' - assert_quiet_exit + assert_test_pass } @@ -62,7 +62,7 @@ load test_helper test_p_partial () { run printf 'a\nb\nc' run refute_line "$1" 'd' - assert_quiet_exit + assert_test_pass } @test 'refute_line() -p <partial>: enables partial matching' { @@ -77,7 +77,7 @@ test_p_partial () { @test "refute_line() --partial <partial>: returns 0 if <partial> is not a substring in any line in \`\${lines[@]}'" { run printf 'a\nb\nc' run refute_line --partial 'd' - assert_quiet_exit + assert_test_pass } @test "refute_line() --partial <partial>: returns 1 and displays details if <partial> is a substring in any line in \`\${lines[@]}'" { @@ -117,7 +117,7 @@ test_p_partial () { test_r_regexp () { run printf 'a\nb\nc' run refute_line "$1" '^.d' - assert_quiet_exit + assert_test_pass } @test 'refute_line() -e <regexp>: enables regular expression matching' { @@ -132,7 +132,7 @@ test_r_regexp () { @test "refute_line() --regexp <regexp>: returns 0 if <regexp> does not match any line in \`\${lines[@]}'" { run printf 'a\nb\nc' run refute_line --regexp '.*d.*' - assert_quiet_exit + assert_test_pass } @test "refute_line() --regexp <regexp>: returns 1 and displays details if <regexp> matches any lines in \`\${lines[@]}'" { @@ -172,7 +172,7 @@ test_r_regexp () { test_n_index () { run printf 'a\nb\nc' run refute_line "$1" 1 'd' - assert_quiet_exit + assert_test_pass } @test 'refute_line() -n <idx> <expected>: matches against the <idx>-th line only' { @@ -201,7 +201,7 @@ test_n_index () { @test "refute_line() --index <idx> <unexpected>: returns 0 if <unexpected> does not equal \`\${lines[<idx>]}'" { run printf 'a\nb\nc' run refute_line --index 1 'd' - assert_quiet_exit + assert_test_pass } @test "refute_line() --index <idx> <unexpected>: returns 1 and displays details if <unexpected> equals \`\${lines[<idx>]}'" { @@ -219,7 +219,7 @@ test_n_index () { @test 'refute_line() --index <idx> <unexpected>: performs literal matching by default' { run printf 'a\nb\nc' run refute_line --index 1 '*' - assert_quiet_exit + assert_test_pass } @@ -231,7 +231,7 @@ test_n_index () { test_index_p_partial () { run printf 'a\nb\nc' run refute_line --index 1 "$1" 'd' - assert_quiet_exit + assert_test_pass } @test 'refute_line() --index <idx> -p <partial>: enables partial matching' { @@ -246,7 +246,7 @@ test_index_p_partial () { @test "refute_line() --index <idx> --partial <partial>: returns 0 if <partial> is not a substring in \`\${lines[<idx>]}'" { run printf 'a\nabc\nc' run refute_line --index 1 --partial 'd' - assert_quiet_exit + assert_test_pass } @test "refute_line() --index <idx> --partial <partial>: returns 1 and displays details if <partial> is a substring in \`\${lines[<idx>]}'" { @@ -270,7 +270,7 @@ test_index_p_partial () { test_index_r_regexp () { run printf 'a\nb\nc' run refute_line --index 1 "$1" '^.b' - assert_quiet_exit + assert_test_pass } @test 'refute_line() --index <idx> -e <regexp>: enables regular expression matching' { @@ -285,7 +285,7 @@ test_index_r_regexp () { @test "refute_line() --index <idx> --regexp <regexp>: returns 0 if <regexp> does not match \`\${lines[<idx>]}'" { run printf 'a\nabc\nc' run refute_line --index 1 --regexp '.*d.*' - assert_quiet_exit + assert_test_pass } @test "refute_line() --index <idx> --regexp <regexp>: returns 1 and displays details if <regexp> matches \`\${lines[<idx>]}'" { @@ -326,5 +326,5 @@ test_index_r_regexp () { @test "refute_line(): \`--' stops parsing options" { run printf 'a\n--\nc' run refute_line -- '-p' - assert_quiet_exit + assert_test_pass } diff --git a/test/50-assert-19-refute.bats b/test/50-assert-19-refute.bats index c58d888..31524fa 100755 --- a/test/50-assert-19-refute.bats +++ b/test/50-assert-19-refute.bats @@ -4,7 +4,7 @@ load test_helper @test 'refute() <expression>: returns 0 if <expression> evaluates to FALSE' { run refute false - assert_quiet_exit + assert_test_pass } @test 'refute() <expression>: returns 1 and displays <expression> if it evaluates to TRUE' { diff --git a/test/test_helper.bash b/test/test_helper.bash index b5728e5..77927fe 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -8,7 +8,7 @@ setup() { # Load library. load '../load' - assert_quiet_exit() { + assert_test_pass() { test "$status" -eq 0 test "${#lines[@]}" -eq 0 } |