Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog][kac] and this project adheres to
* fix `run --keep-empty-lines` counting trailing `\n` as (empty) new line (#711)
* fix short flag unpacker creating bogus command lines with valued flags (#732)
* fix formatter becoming confused with retries (#734)
* fix `--gather-test-outputs-in` fails on tests with `/` (#735)

#### Documentation

Expand Down
8 changes: 4 additions & 4 deletions libexec/bats-core/bats-exec-file
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,6 @@ bats_create_file_tempdirs() {

trap 'BATS_INTERRUPTED=true' INT

if [[ -n "$extended_syntax" ]]; then
printf "suite %s\n" "$filename"
fi

BATS_FILE_FIRST_TEST_NUMBER_IN_SUITE=0 # predeclare as Bash 3.2 does not support declare -g
bats_read_tests_list_file

Expand All @@ -364,6 +360,10 @@ if [[ ${#tests_to_run[@]} -eq 0 ]]; then
exit 0
fi

if [[ -n "$extended_syntax" ]]; then
printf "suite %s\n" "$filename"
fi

# requires the test list to be read but not empty
bats_create_file_tempdirs

Expand Down
2 changes: 1 addition & 1 deletion libexec/bats-core/bats-exec-test
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bats_exit_trap() {
if [[ -n "$should_retry" ]]; then
try_suffix="-try$BATS_TEST_TRY_NUMBER"
fi
cp "$BATS_OUT" "$BATS_GATHER_TEST_OUTPUTS_IN/$BATS_SUITE_TEST_NUMBER$try_suffix-$BATS_TEST_DESCRIPTION.log"
cp "$BATS_OUT" "$BATS_GATHER_TEST_OUTPUTS_IN/$BATS_SUITE_TEST_NUMBER$try_suffix-${BATS_TEST_DESCRIPTION/\//%2F}.log"
fi
rm -f "$BATS_OUT"
exit "$status"
Expand Down
8 changes: 8 additions & 0 deletions test/bats.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,14 @@ END_OF_ERR_MSG
[ "$(find "$OUTPUT_DIR" -type f | wc -l)" -eq 1 ]
}

@test "--gather-test-output-in works with slashes in test names" {
local OUTPUT_DIR="$BATS_TEST_TMPDIR/logs"
bats_require_minimum_version 1.5.0

reentrant_run -0 bats --gather-test-outputs-in "$OUTPUT_DIR" "$FIXTURE_ROOT/test_with_slash.bats"
[ -e "$OUTPUT_DIR/1-test with %2F in name.log" ]
}

@test "Tell about missing flock and shlock" {
if ! command -v parallel; then
skip "this test requires GNU parallel to be installed"
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/bats/test_with_slash.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@test "test with / in name" {
true
}