Skip to content

Commit

Permalink
Merge pull request #271 from TypedDevs/docs/add-bash-style-on-examples
Browse files Browse the repository at this point in the history
Minor docs style improvements
  • Loading branch information
Chemaclass authored Jun 20, 2024
2 parents 74bdc63 + 8dfadaa commit f93616b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Run a core assert function standalone without a test context. Read more: [Standa
```bash [Example]
./bashunit --assert equals "foo" "bar"
```
```bash [Output]
```[Output]
✗ Failed: Main::exec assert
Expected 'foo'
but got 'bar'
Expand Down Expand Up @@ -160,7 +160,7 @@ Upgrade **bashunit** to latest version.
Displays a help message with all allowed arguments and options.

::: code-group
```-vue [Output]
```[Output]
bashunit [arguments] [options]
Arguments:
Expand Down
30 changes: 15 additions & 15 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If a directory is specified, it will execute tests within files ending in `test.
If you use wildcards, **bashunit** will run any tests it finds.

::: code-group
```[Example]
```bash [Example]
# all tests inside the tests directory
DEFAULT_PATH=tests

Expand All @@ -41,10 +41,10 @@ Verbose is the default output, but it can be overridden by the environment confi
Similar as using `-s|--simple|-v|--verbose` option on the [command line](/command-line#output).

::: code-group
```[Simple output]
```bash [Simple output]
....
```
```[.env]
```bash [.env]
SIMPLE_OUTPUT=true
```
:::
Expand All @@ -57,7 +57,7 @@ Running tests/functional/logic_test.sh
✓ Passed: Should validate an ok exit code
✓ Passed: Text should be equal
```
```[.env]
```bash [.env]
SIMPLE_OUTPUT=false
```
:::
Expand All @@ -80,10 +80,10 @@ Specifies if you want to show the bashunit header. `true` by default.
Additionally, you can use the env-var `HEADER_ASCII_ART` to display bashunit in ASCII. `false` by default.

::: code-group
```[Without header]
``` [Without header]
✓ Passed: foo bar
```
```[.env]
```bash [.env]
SHOW_HEADER=false
```
:::
Expand All @@ -94,7 +94,7 @@ bashunit - {{ pkg.version }} // [!code hl]
✓ Passed: foo bar
```
```[.env]
```bash [.env]
SHOW_HEADER=true
```
:::
Expand All @@ -110,7 +110,7 @@ __ _ _ // [!code hl]
✓ Passed: foo bar
```
```[.env]
```bash [.env]
SHOW_HEADER=true
HEADER_ASCII_ART=true
```
Expand All @@ -120,23 +120,23 @@ HEADER_ASCII_ART=true

> `SHOW_EXECUTION_TIME=true|false`
Specifies if you want to display the execution time after running **bashunit**. `true` by default.
Specify if you want to display the execution time after running **bashunit**. `true` by default.

::: warning
This feature is not available on macOS.
:::

::: code-group
```[With execution time]
```-vue [With execution time]
✓ Passed: foo bar
Tests: 1 passed, 1 total
Assertions: 3 passed, 3 total
All tests passed
Time taken: 14 ms // [!code hl]
Time taken: 14 ms // [!code hl]
```
```[.env]
SHOW_EXECUTION_TIMEER=true
```bash [.env]
SHOW_EXECUTION_TIMER=true
```
:::

Expand All @@ -148,8 +148,8 @@ Tests: 1 passed, 1 total
Assertions: 3 passed, 3 total
All tests passed
```
```[.env]
SHOW_EXECUTION_TIMEER=false
```bash [.env]
SHOW_EXECUTION_TIMER=false
```
:::

Expand Down
7 changes: 6 additions & 1 deletion docs/standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ You can use all bashunit assertions outside any tests if you would like to use t

If you want to use the nice assertions syntax of bashunit - without the tests context/functions, but to end-to-end tests executables, you can use the `-a|--assert` option when running `./bashunit` and call the assertion directly from there.

The return exit code will be `0` for success assertions and `1` for failures.
The return exit code will be:
- `0` success assertion
- `1` failed assertion
- `127` non-existing function

::: info
The prefix `assert_` is optional.
Expand All @@ -16,6 +19,7 @@ The prefix `assert_` is optional.
```bash [Example]
# with `assert_` prefix
./bashunit -a assert_equals "foo" "foo"

# or without prefix
./bashunit -a equals "foo" "foo"
```
Expand All @@ -28,6 +32,7 @@ The prefix `assert_` is optional.
```bash [Example]
# with `assert_` prefix
./bashunit -a assert_not_equals "foo" "foo"

# or without prefix
./bashunit -a not_equals "foo" "foo"
```
Expand Down

0 comments on commit f93616b

Please sign in to comment.