-
Notifications
You must be signed in to change notification settings - Fork 53
/
common_input_test.json
112 lines (112 loc) · 2.58 KB
/
common_input_test.json
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
[
{
"description" : "convert array into fake nested array",
"input": {
"FILE": [
"pipo",
"molo",
"toto"
],
"EMPTY_ARRAY" : []
},
"expect_args": [
"declare -A args",
"args['EMPTY_ARRAY,#']=0",
"args['FILE,0']='pipo'",
"args['FILE,1']='molo'",
"args['FILE,2']='toto'",
"args['FILE,#']=3"
],
"expect_global": [
"EMPTY_ARRAY=()",
"FILE=('pipo' 'molo' 'toto')"
]
},
{
"description" : "handle number value and output them as number",
"input": {
"--counter": 2
},
"expect_args": [
"declare -A args",
"args['--counter']=2"
],
"expect_global": [
"counter=2"
]
},
{
"description" : "handle number in string and output them as string",
"input": {
"--counter": "2"
},
"expect_args": [
"declare -A args",
"args['--counter']='2'"
],
"expect_global": [
"counter='2'"
]
},
{
"description" : "handle boolean, output as unquoted string (bash as no boolean type)",
"input": {
"bool": true,
"bool2": false
},
"expect_args": [
"declare -A args",
"args['bool']=true",
"args['bool2']=false"
],
"expect_global": [
"bool=true",
"bool2=false"
]
},
{
"description" : "PR52 - ensure double-dash is skipped in global mode, not in assoc mode",
"Notes" : [
"input argument keys will be sorted by docopts, so expected must match the same order",
"result are compared a string",
"get the keys order: jq '.[]|select(.description | test (\"PR52\"))|.input|keys|sort' < common_input_test.json"
],
"input": {
"--": true,
"-o": false,
"<unparsed_option>": [
"one",
"-p",
"-auto-approve",
"two"
],
"double-dash": true,
"-p": false
},
"expect_args": [
"declare -A args",
"args['--']=true",
"args['-o']=false",
"args['-p']=false",
"args['<unparsed_option>,0']='one'",
"args['<unparsed_option>,1']='-p'",
"args['<unparsed_option>,2']='-auto-approve'",
"args['<unparsed_option>,3']='two'",
"args['<unparsed_option>,#']=4",
"args['double-dash']=true"
],
"expect_global": [
"o=false",
"p=false",
"unparsed_option=('one' '-p' '-auto-approve' 'two')",
"double_dash=true"
],
"expect_global_prefix": [
"ARGS___=true",
"ARGS_o=false",
"ARGS_p=false",
"ARGS_unparsed_option=('one' '-p' '-auto-approve' 'two')",
"ARGS_double_dash=true"
]
}
]