Skip to content

Commit

Permalink
🧪 test(docs_test.go): add test for ToTabularMarkdown with custom app …
Browse files Browse the repository at this point in the history
…path
  • Loading branch information
tarampampam committed May 1, 2023
1 parent d36393b commit 05cf386
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ func TestToTabularMarkdownFull(t *testing.T) {
expectFileContent(t, "testdata/expected-tabular-markdown-full.md", res)
}

func TestToTabularMarkdownWithCustomAppPath(t *testing.T) {
// Given
app := testApp()

// When
res, err := app.ToTabularMarkdown("/usr/local/bin")

// Then
expect(t, err, nil)
expectFileContent(t, "testdata/expected-tabular-markdown-custom-app-path.md", res)
}

func TestToTabularToFileBetweenTags(t *testing.T) {
expectedDocs, fErr := os.ReadFile("testdata/expected-tabular-markdown-full.md")
expect(t, fErr, nil) // read without error
Expand Down
117 changes: 117 additions & 0 deletions testdata/expected-tabular-markdown-custom-app-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
## CLI interface - greet

Description of the application.

Some app.

> app [first_arg] [second_arg]
Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] [COMMAND] [COMMAND FLAGS] [ARGUMENTS...]
```

Global flags:

| Name | Description | Default value | Environment variables |
|-----------------------------|--------------------|:-------------:|:-----------------------:|
| `--socket="…"` (`-s`) | some 'usage' text | `value` | *none* |
| `--flag="…"` (`--fl`, `-f`) | | | *none* |
| `--another-flag` (`-b`) | another usage text | `false` | `EXAMPLE_VARIABLE_NAME` |

### `config` command (aliases: `c`)

another usage test.

Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] config [COMMAND FLAGS] [ARGUMENTS...]
```

The following flags are supported:

| Name | Description | Default value | Environment variables |
|-----------------------------|--------------------|:-------------:|:---------------------:|
| `--flag="…"` (`--fl`, `-f`) | | | *none* |
| `--another-flag` (`-b`) | another usage text | `false` | *none* |

### `config sub-config` subcommand (aliases: `s`, `ss`)

another usage test.

Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] config sub-config [COMMAND FLAGS] [ARGUMENTS...]
```

The following flags are supported:

| Name | Description | Default value | Environment variables |
|-------------------------------------|-----------------|:-------------:|:---------------------:|
| `--sub-flag="…"` (`--sub-fl`, `-s`) | | | *none* |
| `--sub-command-flag` (`-s`) | some usage text | `false` | *none* |

### `info` command (aliases: `i`, `in`)

retrieve generic information.

Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] info [ARGUMENTS...]
```

### `some-command` command

Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] some-command [ARGUMENTS...]
```

### `usage` command (aliases: `u`)

standard usage text.

> Usage for the usage text
> - formatted: Based on the specified ConfigMap and summon secrets.yml
> - list: Inspect the environment for a specific process running on a Pod
> - for_effect: Compare 'namespace' environment with 'local'
> ```
> func() { ... }
> ```
> Should be a part of the same code block
Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] usage [COMMAND FLAGS] [ARGUMENTS...]
```

The following flags are supported:

| Name | Description | Default value | Environment variables |
|-----------------------------|--------------------|:-------------:|:---------------------:|
| `--flag="…"` (`--fl`, `-f`) | | | *none* |
| `--another-flag` (`-b`) | another usage text | `false` | *none* |

### `usage sub-usage` subcommand (aliases: `su`)

standard usage text.

> Single line of UsageText
Usage:

```bash
$ /usr/local/bin [GLOBAL FLAGS] usage sub-usage [COMMAND FLAGS] [ARGUMENTS...]
```

The following flags are supported:

| Name | Description | Default value | Environment variables |
|-----------------------------|-----------------|:-------------:|:---------------------:|
| `--sub-command-flag` (`-s`) | some usage text | `false` | *none* |

0 comments on commit 05cf386

Please sign in to comment.