项目作者: kanga333

项目描述 :
Simple command line assertion tool.
高级语言: Go
项目地址: git://github.com/kanga333/cliassert.git
创建时间: 2018-05-21T12:32:08Z
项目社区:https://github.com/kanga333/cliassert

开源协议:MIT License

下载


cliassert

Build Status
Coverage Status
LICENSE

Description

Simple command line assertion tool.

Synopsis

  1. cliassert [ -assertion-case value ] command

Examples

You can test the result of command execution.

  1. % cliassert -stdout-contain ok echo case-is-ok
  2. % echo $?
  3. 0

If the test fails, details will be displayed on stderr.

  1. % cliassert -stdout-contain ok echo case-is-ng
  2. [failure] stdout should contain ok.
  3. % echo $?
  4. 1

Multiple tests can be set.
If the -v option is added, the details of the success case will also be displayed.

  1. % cliassert -v -stdout-contain case -stdout-contain ok echo case-is-ng
  2. [exit-status] 0
  3. [stdout]
  4. case-is-ng
  5. [stderr]
  6. ---
  7. [success] stdout should contain case.
  8. [failure] stdout should contain ok.
  9. 2 cases, 1 failures.

You can pass the standard output of a command to standard output using the pass option.

  1. % cliassert -pass -exit-status 0 echo pass
  2. pass

You can also use pipe.

  1. % echo pipe | cliassert -stdout-contain pipe

Options

  1. -exit-status value
  2. String equal to exit-status
  3. -pass
  4. Pass stdout of command to stdout
  5. -stderr-contain value
  6. String contained in stderr
  7. -stderr-match value
  8. Regex matching stderr
  9. -stderr-not-contain value
  10. String not contained in stderr
  11. -stderr-not-match value
  12. Regex not matching stderr
  13. -stdout-contain value
  14. String contained in stdout
  15. -stdout-match value
  16. Regex matching stdout
  17. -stdout-not-contain value
  18. String not contained in stdout
  19. -stdout-not-match value
  20. Regex not matching stdout
  21. -v Show verbose