作者:大耍酷的微博Katharine | 来源:互联网 | 2023-07-29 09:10
本文由编程笔记#小编为大家整理,主要介绍了markdown BATS断言库比较相关的知识,希望对你有一定的参考价值。
> _"Who would dare assert that we know all there is to be known?"_
> ~ Galileo Galilei
## Introduction
At the time of this writing there are 3 separate libraries that offer assertions
for the [Bash Automated Testing System](https://github.com/bats-core/bats-core) (otherwise known as BATS).
These are:
- [jasonkarns/bats-assert](https://github.com/jasonkarns/bats-assert)
- [thingsym/bats-assertion](https://github.com/thingsym/bats-assertion)
- [ztombol/bats-assert](https://github.com/ztombol/bats-assert)
This page shows a comparison of the functions each projects offers.
## Legend
| Symbol | Meaning |
| :-------: | ------- |
| JBA | [jasonkarns/bats-assert](https://github.com/jasonkarns/bats-assert)
| TBA | [thingsym/bats-assertion](https://github.com/thingsym/bats-assertion)
| ZBA | [ztombol/bats-assert](https://github.com/ztombol/bats-assert)
| **`foo`** | Affirmatory function |
| `foo` | Negatory function |
| :+1: | Function present |
| :v: | Alias present |
## Assert comparison Table
| Function Name | Also Known As | JBA | TBA | ZBA |
| ----------------------------- | ------------------------- | :---: | :---: | :---: |
| **`pass`** | | | | |
| `fail` | `flunk` | :v: | | |
| **`assert`** | | :+1: | | :+1: |
| `refute` | | :+1: | | :+1: |
| **`assert_contains`** | | :+1: | | |
| `refute_contains` | | :+1: | | |
| **`assert_equal`** | | :+1: | :+1: | :+1: |
| `refute_equal` | `assert_fail_equal` | | :v: | |
| **`assert_line`** | | :+1: | | :+1: |
| `refute_line` | | :+1: | | :+1: |
| **`assert_lines_equal`** | | | :+1: | |
| `refute_lines_equal` | `assert_fail_lines_equal` | | :v: | |
| **`assert_lines_match`** | | | :+1: | |
| `refute_lines_match` | `assert_fail_lines_match` | | :v: | |
| **`assert_match`** | | | :+1: | |
| `refute_match` | `assert_fail_match` | | :v: | |
| **`assert_output`** | | :+1: | | :+1: |
| `refute_output` | | | | :+1: |
| **`assert_output_contains`** | | :+1: | | |
| `refute_output_contains` | | :+1: | | |
| **`assert_success`** | | :+1: | :+1: | :+1: |
| `refute_success` | **`assert_failure`** | :v: | :v: | :v: |
| **`assert_starts_with`** | | :+1: | | |
| `refute_starts_with` | | | | |
| **`assert_status`** | | | :+1: | |
| `refute_status` | | | | |
| _TOTAL (Per project)_ |
| _14_ | _11_ | _9_ |
## Summary
23 Function present across all projects,
3 Function missing across all projects (`pass`, `refute_starts_with`, `refute_status`)