diff --git a/libexec/bats-preprocess b/libexec/bats-preprocess index 04297ed0..b53ebe57 100755 --- a/libexec/bats-preprocess +++ b/libexec/bats-preprocess @@ -31,7 +31,7 @@ encode_name() { tests=() index=0 -pattern='^ *@test *([^ ].*) *\{ *(.*)$' +pattern='^[[:space:]]*@test[[:space:]]+([^ ].*)[[:space:]]+\{ *(.*)$' while IFS= read -r line; do let index+=1 diff --git a/test/bats.bats b/test/bats.bats index f1aff293..edf59e4b 100755 --- a/test/bats.bats +++ b/test/bats.bats @@ -262,3 +262,14 @@ fixtures bats [ $status -eq 0 ] [ "${lines[1]}" = "ok 1 loop_func" ] } + +@test "testing @test line with tabs" { + run bats "$FIXTURE_ROOT/tabs.bats" + [ $status -eq 0 ] + [ "${lines[1]}" = 'ok 1 tabs1' ] + [ "${lines[2]}" = 'ok 2 tabs2' ] + [ "${lines[3]}" = 'ok 3 tabs3' ] + [ "${lines[4]}" = 'ok 4 tabs4' ] + [ "${lines[5]}" = 'ok 5 tabs5' ] + [ "${lines[6]}" = 'ok 6 tabs6' ] +} diff --git a/test/fixtures/bats/tabs.bats b/test/fixtures/bats/tabs.bats new file mode 100644 index 00000000..9187355a --- /dev/null +++ b/test/fixtures/bats/tabs.bats @@ -0,0 +1,23 @@ +@test "tabs1" { + true +} + + @test "tabs2" { + true + } + +@test "tabs3" { + true +} + +@test "tabs4" { + true +} + + @test "tabs5" { + true + } + + @test "tabs6" { + true + }