Bats Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 22: Line 22:
===$(output)===
===$(output)===


<code>$(output)</code> coalesce lines.
<code>$(output)</code> coalesce lines:
 
<syntaxhighlight lang='bash'>
some_command=....
[...]
run ${some_command}
[[ ${output} =~ .*Stack[[:space:]]test[[:space:]]is[[:space:]]stable[[:space:]]and[[:space:]]running* ]]
</syntaxhighlight>


===$(lines)===
===$(lines)===


=Setup/Teardown=
=Setup/Teardown=

Revision as of 00:43, 2 October 2019

Internal

Test

Tests are executed in the order they're specified in the file.

@test "something" {
  ...
}

Run a Command and Check the Status and Output

some_command=....
[...]
run ${some_command}
[[ ${status} -eq 0 ]]
[[ ${output} =~ .*Stack[[:space:]]test[[:space:]]is[[:space:]]stable[[:space:]]and[[:space:]]running* ]]

$(output)

$(output) coalesce lines:

some_command=....
[...]
run ${some_command}
[[ ${output} =~ .*Stack[[:space:]]test[[:space:]]is[[:space:]]stable[[:space:]]and[[:space:]]running* ]]

$(lines)

Setup/Teardown