OXIESEC PANEL
- Current Dir:
/
/
lib
/
bats-core
Server IP: 82.112.239.19
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/20/2025 01:49:09 AM
r-xr-xr-x
📄
common.bash
6.52 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
formatter.bash
6.32 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
preprocessing.bash
762 bytes
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
semaphore.bash
3.74 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
test_functions.bash
10.33 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
tracing.bash
13.2 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
validator.bash
1.01 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
📄
warnings.bash
1.85 KB
09/16/2022 10:24:19 PM
rwxr-xr-x
Editing: validator.bash
Close
#!/usr/bin/bash bats_test_count_validator() { trap '' INT # continue forwarding header_pattern='[0-9]+\.\.[0-9]+' IFS= read -r header # repeat the header printf "%s\n" "$header" # if we detect a TAP plan if [[ "$header" =~ $header_pattern ]]; then # extract the number of tests ... local expected_number_of_tests="${header:3}" # ... count the actual number of [not ] oks... local actual_number_of_tests=0 while IFS= read -r line; do # forward line printf "%s\n" "$line" case "$line" in 'ok '*) (( ++actual_number_of_tests )) ;; 'not ok'*) (( ++actual_number_of_tests )) ;; esac done # ... and error if they are not the same if [[ "${actual_number_of_tests}" != "${expected_number_of_tests}" ]]; then printf '# bats warning: Executed %s instead of expected %s tests\n' "$actual_number_of_tests" "$expected_number_of_tests" return 1 fi else # forward output unchanged cat fi }