Skip to content

Commit 098361a

Browse files
Add entry for Bats (#59)
1 parent d240742 commit 098361a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

_posts/2021-10-23-bats.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
layout: post
3+
title: "Bats"
4+
description: "A TAP-compliant testing framework for Bash."
5+
category: bash
6+
tags: [bash, testing, ci]
7+
---
8+
## Usage
9+
Write tests into `*.bats` files like:
10+
11+
```
12+
#!/usr/bin/env bats
13+
14+
@test "addition using bc" {
15+
result="$(echo 2+2 | bc)"
16+
[ "$result" -eq 4 ]
17+
}
18+
```
19+
20+
Then run the test:
21+
22+
```
23+
$ bats test.bats
24+
✓ addition using bc
25+
26+
1 test, 0 failures
27+
```
28+
29+
## Links
30+
* [Source Code (GitHub)][https://github.com/bats-core/bats-core]
31+
* [Documentation][https://bats-core.readthedocs.io/]

0 commit comments

Comments
 (0)