Skip to content

Commit 596954f

Browse files
authored
Add bashunit (#82)
* Add bashunit * Add bashunit authors * Add bashunit docs link
1 parent e0bcaa3 commit 596954f

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

_posts/2023-09-11-bashunit.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
layout: post
3+
title: "bashunit"
4+
description: "A simple testing library for bash scripts."
5+
category: bash
6+
tags: [bash, testing, ci]
7+
---
8+
9+
## Usage
10+
11+
Write tests files like:
12+
13+
```bash
14+
# file: tests/my_test.sh
15+
16+
function test_using_snake_case() {
17+
assertEquals "1" "1"
18+
assertContains "Linux" "GNU/Linux"
19+
}
20+
21+
function testUsingCamelCase() {
22+
assertNotContains "Linus" "GNU/Linux"
23+
assertMatches ".*Linu*" "GNU/Linux"
24+
assertExitCode "0"
25+
}
26+
```
27+
28+
Then run the test:
29+
30+
```bash
31+
$ bashunit tests/my_test.sh
32+
33+
Running logic_test.sh
34+
✓ Passed: UsingCamelCase
35+
✓ Passed: Using snake case
36+
37+
Tests: 2 passed, 2 total
38+
Assertions: 5 passed, 5 total
39+
All tests passed
40+
```
41+
42+
## Links
43+
44+
* [Source Code (GitHub)](https://github.com/TypedDevs/bashunit)
45+
* Authors: [Jose Maria Valera Reales](https://github.com/Chemaclass), [Emmanuel Valverde Ramos](https://github.com/khru), [Antonio Gonzalez Gea
46+
](https://github.com/Tito-Kati)
47+
* [Documentation](https://bashunit.typeddevs.com)
48+
49+
{% include JB/setup %}
50+

0 commit comments

Comments
 (0)