File tree Expand file tree Collapse file tree 5 files changed +88
-3
lines changed Expand file tree Collapse file tree 5 files changed +88
-3
lines changed Original file line number Diff line number Diff line change 4747 run : bundle exec rspec
4848
4949 static_analysis :
50- name : Static analysis of Example files
50+ name : Example files static analysis
5151
5252 runs-on : ubuntu-latest
5353
8585 run : bundle exec run shfmt
8686
8787 json_schema :
88- name : Validate JSON schemas
88+ name : JSON schemas validation
8989
9090 runs-on : ubuntu-latest
9191
Original file line number Diff line number Diff line change 66
77 let ( :fixture ) { :basic_argument }
88
9+ describe '#default_string' do
10+ context 'when default is an array' do
11+ let ( :fixture ) { :default_array }
12+
13+ it 'returns a shell-escaped string suitable to be shell array source' do
14+ expect ( subject . default_string ) . to eq 'spaced\\ one two'
15+ end
16+ end
17+
18+ context 'when default is string and repeatable is false' do
19+ let ( :fixture ) { :default_string }
20+
21+ it 'returns it as is' do
22+ expect ( subject . default_string ) . to eq 'spaced one'
23+ end
24+ end
25+
26+ context 'when default is string and repeatable is true' do
27+ let ( :fixture ) { :default_string_with_repeatable }
28+
29+ it 'returns a single string' do
30+ expect ( subject . default_string ) . to eq 'spaced\\ one'
31+ end
32+ end
33+ end
34+
935 describe '#usage_string' do
1036 it 'returns a string suitable to be used as a usage pattern' do
1137 expect ( subject . usage_string ) . to eq '[FILE]'
Original file line number Diff line number Diff line change 3030 end
3131 end
3232
33+ describe '#default_string' do
34+ context 'when default is an array' do
35+ let ( :fixture ) { :default_array }
36+
37+ it 'returns a shell-escaped string suitable to be shell array source' do
38+ expect ( subject . default_string ) . to eq 'spaced\\ one two'
39+ end
40+ end
41+
42+ context 'when default is string and repeatable is false' do
43+ let ( :fixture ) { :default_string }
44+
45+ it 'returns it as is' do
46+ expect ( subject . default_string ) . to eq 'spaced one'
47+ end
48+ end
49+
50+ context 'when default is string and repeatable is true' do
51+ let ( :fixture ) { :default_string_with_repeatable }
52+
53+ it 'returns a single string' do
54+ expect ( subject . default_string ) . to eq 'spaced\\ one'
55+ end
56+ end
57+ end
58+
3359 describe '#name' do
3460 context 'with both short and long options' do
3561 it 'returns the long option' do
Original file line number Diff line number Diff line change 88:repeatable :
99 name : file
1010 repeatable : true
11+
12+ :default_string :
13+ name : file
14+ repeatable : false
15+ default : spaced one
16+
17+ :default_array :
18+ name : file
19+ repeatable : true
20+ default : [spaced one, two]
21+
22+ :default_string_with_repeatable :
23+ name : file
24+ repeatable : true
25+ default : spaced one
Original file line number Diff line number Diff line change 2525:completions_completions :
2626 long : --path
2727 short : -p
28- completions : [<file>, README.md]
28+ completions : [<file>, README.md]
29+
30+ :default_string :
31+ long : --file
32+ arg : path
33+ repeatable : false
34+ default : spaced one
35+
36+ :default_array :
37+ long : --file
38+ arg : path
39+ repeatable : true
40+ default : [spaced one, two]
41+
42+ :default_string_with_repeatable :
43+ long : --file
44+ arg : path
45+ repeatable : true
46+ default : spaced one
You can’t perform that action at this time.
0 commit comments