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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/test_bench/executable/parse_arguments.rb', line 50
def call
loop do
switch = next_switch
case switch
when '--', nil
break
when '-a', '--abort-on-failure'
env['TEST_BENCH_ABORT_ON_FAILURE'] = 'on'
when '-x', '--exclude'
exclude_pattern = require_next_argument(switch)
env['TEST_BENCH_EXCLUDE_FILE_PATTERN'] = [
env['TEST_BENCH_EXCLUDE_FILE_PATTERN'],
exclude_pattern
].compact.join(':')
when '-X', '--no-exclude'
env['TEST_BENCH_EXCLUDE_FILE_PATTERN'] = ''
when '-s', '--strict'
env['TEST_BENCH_STRICT'] = 'on'
when '-S', '--no-strict'
env['TEST_BENCH_STRICT'] = 'off'
when '-r', '--require'
library = require_next_argument(switch)
require(library)
when '-I', '--include'
load_path = require_next_argument(switch)
if not $LOAD_PATH.include?(load_path)
$LOAD_PATH << load_path
end
when '--random-seed'
seed = require_next_argument(switch)
env['TEST_BENCH_RANDOM_SEED'] = seed
when '-b', '--omit-backtrace'
omit_pattern = require_next_argument(switch)
env['TEST_BENCH_OMIT_BACKTRACE_PATTERN'] = [
env['TEST_BENCH_OMIT_BACKTRACE_PATTERN'],
omit_pattern
].compact.join(':')
when '-d', '--detail'
env['TEST_BENCH_DETAIL'] = 'on'
when '-D', '--no-detail'
env['TEST_BENCH_DETAIL'] = 'off'
when '--device'
device = require_next_argument(switch)
env['TEST_BENCH_OUTPUT_DEVICE'] = device
when '-l', '--output-level'
output_level = require_next_argument(switch)
env['TEST_BENCH_OUTPUT_LEVEL'] = output_level
when '-q', '--quiet'
env['TEST_BENCH_OUTPUT_LEVEL'] = 'not-passing'
when '-o', '--output-styling'
env['TEST_BENCH_OUTPUT_STYLING'] = 'on'
when '-O', '--no-output-styling'
env['TEST_BENCH_OUTPUT_STYLING'] = 'off'
when '--no-summary'
env['TEST_BENCH_OUTPUT_SUMMARY'] = 'off'
when '-h', '--help'
writer.write("Usage: \#{Defaults.program_name} [options] [paths]\n\nInformational Options:\n Help:\n-h, --help\n Print this help message and exit immediately\n\nExecution Options:\n Abort On Failure:\n-a, --abort-on-failure\n Stops execution if a test fails or a test file aborts\n\n Exclude File Patterns:\n-x, --exclude PATTERN\n Exclude test files that match PATTERN\n If multiple --exclude arguments are supplied, then files that match any will be excluded\n-X, --no-exclude\n Don't exclude any files\nDefault: '*_init.rb'\n\n Strict:\n-s, --strict\n Prohibit skipped tests and contexts, and require at least one test to be performed\n-S, --no-strict\n Relax strictness\nDefault: non strict, unless TEST_BENCH_STRICT is set to 'on'\n\n Require Library:\n-r, --require LIBRARY\n Require LIBRARY before running any files\n-I, --include DIR\n Add DIR to the load path\n\n Random Seed:\n--random-seed SEED\n Pseudorandom number seed\n\nOutput Options:\n Backtrace Formatting:\n-b, --omit-backtrace PATTERN\n Omits backtrace frames that match PATTERN\n If multiple --omit-backtrace arguments are supplied, then frames that match any will be omitted\n\n Detail:\n-d, --detail\n Always show details\n-D, --no-detail\n Never show details\nDefault: print details when their surrounding context failed, unless TEST_DETAIL is set to 'on' or 'off'\n\n Device:\n--device DEVICE\n stderr: redirect output to standard error\n null: don't write any output\nDefault: stdout\n\n Verbosity:\n-l, --output-level LEVEL\n all: print output from every file\n not-passing: print output from files that skip tests and contexts or don't perform any tests\n failure: print output only from files that failed or aborted\n abort: print output only from file that aborted\n-q, --quiet\n Sets output verbosity level to 'not-passing'\nDefault: all\n\n Styling:\n-o, --output-styling\n Enable output text styling\n-O, --no-output-styling\n Disable output text styling\nDefault: enabled if the output device is an interactive terminal\n\n Summary:\n--no-summary\n Don't print summary after running files\n\nPaths to test files (and directories containing test files) can be given after any command line arguments or via STDIN (or both).\n\nIf no paths are given, the directory '\#{Defaults.path}' is scanned for test files.\n\nThe following environment variables can also control execution:\n\n TEST_BENCH_ABORT_ON_FAILURE See --abort-on-failure\n TEST_BENCH_EXCLUDE_FILE_PATTERN See --exclude\n TEST_BENCH_OUTPUT_SUMMARY See --no-summary\n TEST_BENCH_STRICT See --strict\n TEST_BENCH_RANDOM_SEED See --random-seed\n TEST_BENCH_FILTER_BACKTRACE_PATTERN See --filter-backtrace\n TEST_BENCH_DETAIL See --detail\n TEST_BENCH_OUTPUT_DEVICE See --device\n TEST_BENCH_OUTPUT_LEVEL See --output-level\n TEST_BENCH_OUTPUT_STYLING See --output-styling\n TEST_BENCH_DEFAULT_TEST_PATH Specifies default path\n TEST_BENCH_OPTIONS Evaluated as command line arguments similar to RUBYOPT\n\n TEXT\n exit(true)\n\n else\n raise Error, \"Incorrect switch \#{switch}\"\n end\n end\n\n remaining_arguments\nend\n")
|