File tree 1 file changed +42
-2
lines changed
1 file changed +42
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# A smaller test API like [Jest](https://jestjs.io/ja/docs/expect) for bash script.
4
4
#
5
+ # ## Basic Usage
5
6
# ```shell-session
7
+ # # Positive assertions
6
8
# $ x=10
7
9
# $ expects "$x" to_be 10 && echo Success
8
10
# Success
9
- # ```
10
- # ```shell-session
11
+ #
12
+ # # Negative assertions
11
13
# $ x=10
12
14
# $ expects "$x" not to_be 42 && echo Success
13
15
# Success
16
+ #
17
+ # # Failed assertions
18
+ # $ x=42
19
+ # $ expects "$x" to_be 10
20
+ # FAIL: expected {actual} to_be 10, but {actual} is: 42
21
+ # ```
22
+ #
23
+ # ## String Operations
24
+ # ```shell-session
25
+ # # String containment
26
+ # $ str="hello world"
27
+ # $ expects "$str" to_contain "world" && echo Success
28
+ # Success
29
+ # $ expects "$str" not to_contain "moon" && echo Success
30
+ # Success
31
+ #
32
+ # # Pattern matching
33
+ # $ str="hello123"
34
+ # $ expects "$str" to_match "^[a-z]+[0-9]+$" && echo Success
35
+ # Success
36
+ # $ expects "$str" not to_match "^[0-9]+$" && echo Success
37
+ # Success
38
+ # ```
39
+ #
40
+ # ## Value Checks
41
+ # ```shell-session
42
+ # # Boolean assertions
43
+ # $ expects true to_be_true && echo Success
44
+ # Success
45
+ # $ expects false to_be_false && echo Success
46
+ # Success
47
+ #
48
+ # # Existence checks
49
+ # $ var="some value"
50
+ # $ expects "$var" to_be_defined && echo Success
51
+ # Success
52
+ # $ expects "" not to_be_defined && echo Success
53
+ # Success
14
54
# ```
15
55
16
56
actual_value=$1
You can’t perform that action at this time.
0 commit comments