| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
. "$XDG_TEST_DIR/include/testassertions.sh" |
| 4 |
. "$XDG_TEST_DIR/include/testcontrol.sh" |
| 5 |
|
| 6 |
test_var_bleed_set() { |
| 7 |
test_start "$FUNCNAME: set the BLEEDTEST variable" |
| 8 |
|
| 9 |
test_procedure |
| 10 |
|
| 11 |
export BLEED1=i_am_set |
| 12 |
BLEED2=set |
| 13 |
assert_exit 0 export BLEED3="set_within_assert_exit" |
| 14 |
|
| 15 |
test_result |
| 16 |
} |
| 17 |
|
| 18 |
test_var_bleed_read() { |
| 19 |
test_start "$FUNCNAME: read the BLEEDTEST variable" |
| 20 |
|
| 21 |
|
| 22 |
test_procedure |
| 23 |
|
| 24 |
assert_exit 0 echo -n "$BLEED1" |
| 25 |
assert_nostdout |
| 26 |
assert_nostderr |
| 27 |
|
| 28 |
assert_exit 0 echo -n "$BLEED2" |
| 29 |
assert_nostdout |
| 30 |
assert_nostderr |
| 31 |
|
| 32 |
assert_exit 0 echo -n "$BLEED3" |
| 33 |
assert_nostdout |
| 34 |
assert_nostderr |
| 35 |
|
| 36 |
assert_exit 0 echo -n "$BLEED4" |
| 37 |
assert_nostdout |
| 38 |
assert_nostderr |
| 39 |
|
| 40 |
test_result |
| 41 |
} |
| 42 |
|
| 43 |
test_stdout_capture() { |
| 44 |
test_start "$FUNCNAME: stdout capture test. note: FAIL=PASS" |
| 45 |
|
| 46 |
assert_exit 0 echo -n "some output" |
| 47 |
assert_nostdout |
| 48 |
assert_nostderr |
| 49 |
|
| 50 |
test_result |
| 51 |
} |
| 52 |
|
| 53 |
run_test test_var_bleed_set |
| 54 |
run_test test_var_bleed_read |
| 55 |
run_test test_stdout_capture |