From b1f8cdb378565f0b3038d0c3bcbf2d8ed48b5259 Mon Sep 17 00:00:00 2001 From: Benoit Lefebvre Date: Thu, 10 Sep 2015 10:09:45 -0400 Subject: [PATCH 1/2] Issue #98: Added support for tabs in @test definition --- libexec/bats-preprocess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 535f9e7220f8efe2f8a8f62b5bd92b4096b77e21 Mon Sep 17 00:00:00 2001 From: Benoit Lefebvre Date: Thu, 10 Sep 2015 10:10:24 -0400 Subject: [PATCH 2/2] Issue #98: Added test file for tabs support in @test definition --- test/bats.bats | 11 +++++++++++ test/fixtures/bats/tabs.bats | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/fixtures/bats/tabs.bats 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 + }