mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +01:00
preprocess: Add tests for vars, quotes in names
This is in anticipation of refactoring away the `$(eval echo "$quoted_name")` command substitution.
This commit is contained in:
parent
fac51df957
commit
3ab495fda2
|
@ -268,3 +268,17 @@ fixtures bats
|
|||
[ $status -eq 0 ]
|
||||
[ "${lines[1]}" = "ok 1 loop_func" ]
|
||||
}
|
||||
|
||||
@test "expand variables in test name" {
|
||||
SUITE='test/suite' run bats "$FIXTURE_ROOT/expand_var_in_test_name.bats"
|
||||
[ $status -eq 0 ]
|
||||
[ "${lines[1]}" = "ok 1 test/suite: test with variable in name" ]
|
||||
}
|
||||
|
||||
@test "handle quoted and unquoted test names" {
|
||||
run bats "$FIXTURE_ROOT/quoted_and_unquoted_test_names.bats"
|
||||
[ $status -eq 0 ]
|
||||
[ "${lines[1]}" = "ok 1 single-quoted name" ]
|
||||
[ "${lines[2]}" = "ok 2 double-quoted name" ]
|
||||
[ "${lines[3]}" = "ok 3 unquoted" ]
|
||||
}
|
||||
|
|
3
test/fixtures/bats/expand_var_in_test_name.bats
vendored
Normal file
3
test/fixtures/bats/expand_var_in_test_name.bats
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
@test "$SUITE: test with variable in name" {
|
||||
true
|
||||
}
|
11
test/fixtures/bats/quoted_and_unquoted_test_names.bats
vendored
Normal file
11
test/fixtures/bats/quoted_and_unquoted_test_names.bats
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
@test 'single-quoted name' {
|
||||
true
|
||||
}
|
||||
|
||||
@test "double-quoted name" {
|
||||
true
|
||||
}
|
||||
|
||||
@test unquoted {
|
||||
true
|
||||
}
|
Loading…
Reference in New Issue
Block a user