Repository navigation
Expand file tree
/
Copy path_bashunit
More file actions
143 lines (137 loc) · 7.76 KB
/
Copy path_bashunit
File metadata and controls
143 lines (137 loc) · 7.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#compdef bashunit
# zsh completion for bashunit
#
# Install: copy this file as _bashunit into a directory in your $fpath, e.g.
# cp completions/_bashunit /usr/local/share/zsh/site-functions/_bashunit
# then restart zsh (or reinitialize completions with compinit).
#
# Kept in sync with src/main/test.sh and src/main/subcommands.sh by
# tests/unit/main/completions_test.sh (anti-drift).
_bashunit() {
local curcontext="$curcontext" ret=1
# `bashunit assert <fn>` completes the public assertion names.
if (( CURRENT == 3 )) && [ "${words[2]}" = "assert" ]; then
local -a assert_fns
assert_fns=(
assert_array_contains assert_array_length assert_array_not_contains
assert_arrays_equal assert_assertion_fails assert_assertion_fails_with
assert_assertion_passes assert_between assert_command_available assert_command_not_found assert_contains
assert_contains_ignore_case assert_date_after assert_date_before
assert_date_equals assert_date_within_delta assert_date_within_range
assert_directory_exists assert_directory_not_exists assert_duration
assert_duration_greater_than assert_duration_less_than assert_empty
assert_equals assert_exec assert_exit_code assert_false
assert_file_contains assert_file_exists assert_file_not_contains
assert_file_not_exists assert_file_permissions assert_files_equals
assert_files_not_equals assert_general_error assert_greater_or_equal_than
assert_greater_than assert_is_directory assert_is_directory_empty
assert_is_directory_not_empty assert_is_directory_not_readable
assert_is_directory_not_writable assert_is_directory_readable
assert_is_directory_writable assert_is_file assert_is_file_empty assert_is_file_executable
assert_is_file_not_empty assert_is_file_not_executable assert_is_file_not_readable
assert_is_file_not_writable assert_is_file_readable assert_is_file_writable
assert_is_not_symlink assert_is_symlink
assert_json_contains assert_json_equals assert_json_key_exists assert_json_key_not_exists assert_json_length
assert_less_or_equal_than assert_less_than assert_line_count
assert_match_named_snapshot assert_match_named_snapshot_ignore_colors
assert_match_snapshot assert_match_snapshot_ignore_colors assert_matches
assert_not_between assert_not_contains assert_not_empty assert_not_equals assert_not_matches
assert_not_same assert_same assert_string_ends_with
assert_string_matches_format assert_string_not_ends_with
assert_string_not_matches_format assert_string_not_starts_with
assert_string_starts_with assert_successful_code assert_symlink_to assert_true
assert_unsuccessful_code assert_within_delta
)
compadd -a assert_fns
return 0
fi
if (( CURRENT == 2 )); then
local -a subcommands
subcommands=(
'test:Run tests (default command)'
'bench:Run benchmarks'
'doc:Display assertion documentation'
'init:Initialize a new test directory'
'upgrade:Upgrade bashunit to latest version'
'assert:Run standalone assertion'
'watch:Watch files and rerun tests on change'
)
_describe 'bashunit command' subcommands && ret=0
fi
_arguments \
'--custom[Show only the assertions your project defines]' \
'(-a --assert)'{-a,--assert}'[Run a standalone assert function]:function:' \
'(-e --env --boot)'{-e,--env,--boot}'[Load a custom env/bootstrap file]:file:_files' \
'(-f --filter)'{-f,--filter}'[Only run tests matching the name]:name:' \
'--tag[Only run tests with matching @tag; supports a&&b and !a]:tag:' \
'--id[Run one exact test function]:test ID:' \
'--exclude-filter[Skip tests whose name matches]:name:' \
'--suite[Run a named suite from .bashunitrc]:suite:' \
'--list-suites[Print the suites defined in .bashunitrc and exit]' \
'--sandbox[Fail a test that runs an unmocked external command]' \
'--sandbox-allow[Commands the sandbox still allows]:commands:' \
'--exclude-tag[Skip tests with matching @tag]:tag:' \
'--log-junit[Write JUnit XML report]:file:_files' \
'--gha-annotations[GitHub Actions annotations on stdout]:mode:(auto always never)' \
'--report-junit[Write JUnit XML report]:file:_files' \
'--log-gha[Write GitHub Actions workflow-commands log]:file:_files' \
'(-j --jobs)'{-j,--jobs}'[Max N parallel jobs, or auto]:jobs:(auto)' \
'(-p --parallel)'{-p,--parallel}'[Run tests in parallel]' \
'--no-parallel[Run tests sequentially]' \
'(-r --report-html)'{-r,--report-html}'[Write HTML report]:file:_files' \
'--report-tap[Write TAP version 13 report]:file:_files' \
'--report-json[Write machine-readable JSON report]:file:_files' \
'--report-md[Write a Markdown summary]:file:_files' \
'(-s --simple)'{-s,--simple}'[Simple output with dots]' \
'--detailed[Detailed output, the default]' \
'--output[Output format]:format:(text tap json junit)' \
'(-R --run-all)'{-R,--run-all}'[Run all assertions without stopping on first failure]' \
'(-S --stop-on-failure)'{-S,--stop-on-failure}'[Stop on first failure]' \
'--pass-with-no-tests[Exit 0 when the run selects no tests]' \
'--test-timeout[Fail a test running longer than N seconds]:seconds:' \
'--retry[Rerun a failed test up to N extra times]:count:' \
'--repeat[Run each selected test N times]:count:' \
'--random-order[Randomize test execution order]' \
'--fail-on-flaky[Treat tests that only passed after a retry as failures]' \
'--order-by[Execution order]:mode:(defined defects random)' \
'--seed[Seed for random order]:seed:' \
'--shard[Run shard i of n]:shard:' \
'--rerun-failed[Replay only the tests that failed on the last run]' \
'--changed[Run only the test files changed since a git ref]::ref:' \
'(--list --dry-run)'{--list,--dry-run}'[Print the tests that would run, then exit]' \
'--list-format[Rendering for --list]:format:(text json)' \
'--list-tags[Print the tags of the selected files, one per line, then exit]' \
'(-u --snapshot-update)'{-u,--snapshot-update}'[Rewrite existing snapshots from the actual value]' \
'--no-snapshot-create[Fail instead of recording a missing snapshot]' \
'--snapshot-prune[Delete snapshot files no test resolved]' \
'--snapshot-report-unused[List snapshot files no test resolved]' \
'(-vvv --verbose)'{-vvv,--verbose}'[Show execution details]' \
'--debug[Enable shell debug mode]::file:_files' \
'--no-output[Suppress all output]' \
'--failures-only[Only show failures]' \
'--fail-on-risky[Treat tests without assertions as failures]' \
'--profile[Report the slowest tests]' \
'--no-progress[Suppress real-time progress]' \
'--show-output[Show test output on failure]' \
'--no-output-on-failure[Hide test output on failure]' \
'--show-skipped[Show skipped tests summary]' \
'--show-incomplete[Show incomplete tests summary]' \
'--strict[Enable strict shell mode]' \
'--skip-env-file[Skip .env loading]' \
'(-l --login)'{-l,--login}'[Run tests in login shell context]' \
'(-w --watch)'{-w,--watch}'[Watch for changes and rerun tests]' \
'--no-color[Disable colored output]' \
'--coverage[Enable code coverage tracking]' \
'--coverage-paths[Paths to track]:paths:_files' \
'--coverage-exclude[Coverage exclusion patterns]:pattern:' \
'--coverage-report[LCOV output path]:file:_files' \
'--coverage-report-html[Generate HTML coverage report]::dir:_files' \
'--coverage-report-cobertura[Cobertura XML coverage report]::file:_files' \
'--coverage-min[Minimum coverage threshold]:percent:' \
'--coverage-diff[Report coverage only for lines changed since ref]:ref:' \
'--no-coverage-report[Console coverage output only]' \
'(-h --help)'{-h,--help}'[Show help message]' \
'*:path:_files' && ret=0
return ret
}
_bashunit "$@"