Execute arguments as command

Runs the arguments as a command and then stores output and exit status into special global variables. It returns with status code 0 to help making assertions in your test case.

Usage

-0 to -255Expect that the command exits with the given exit status.
!Expect that the command exits with a non-zero exit status.
--keep-empty-linesKeep empty lines in ${lines[0]}.
--separate-stderrStore STDOUT in $output and STDERR in $stderr. Lines are stored in $lines and $stderr_lines.

Examples

Executing a command with run
1
2
3
@test "executing a command with run" {
    run -0 command -v bash
}
BashSupport Pro 是一款shell 脚本集成开发环境,支持 bats-core 的 run - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款