aboutsummaryrefslogtreecommitdiff
path: root/examples/test-examples.toml
blob: 6f4504812704b0c81c6720c37525fe3c185b7af7 (plain) (blame)
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
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
[[test.example-basic]]
command = "greet"
expect.exit-code = 0
expect.result = "Hello, World!"

[[test.example-basic]]
command = "greet Alice"
expect.exit-code = 0
expect.result = "Hello, Alice!"

[[test.example-exitcode]]
command = "hello Alice"
expect.exit-code = 0
expect.result = "Hello, Alice"

[[test.example-exitcode]]
command = "hello"
expect.exit-code = 1
expect.result = "No name provided (with exit code 1)"

[[test.example-error-handling]]
command = "hello"
expect.exit-code = 0
expect.result = "No name provided"

[[test.example-error-handling]]
command = "hello MyBestFriendAlice"
expect.exit-code = 0
expect.result = "Name too long: 17 > 10"

[[test.example-error-handling]]
command = "hello Alice"
expect.exit-code = 0
expect.result = "Name not available"

[[test.example-error-handling]]
command = "hello Peter"
expect.exit-code = 0
expect.result = "Hello, Peter"

[[test.example-error-handling]]
command = "hallo"
expect.exit-code = 0
expect.result = "Command not found: \"hallo\""

[[test.example-argument-parse]]
command = "transfer"
expect.exit-code = 0
expect.result = "file:  (1048576)"

[[test.example-argument-parse]]
command = "transfer --dir src"
expect.exit-code = 0
expect.result = "dir: src (1048576)"

[[test.example-argument-parse]]
command = "transfer --size 500 myfile.txt"
expect.exit-code = 0
expect.result = "file: myfile.txt (500)"

[[test.example-argument-parse]]
command = "strict-transfer README.md"
expect.exit-code = 0
expect.result = "file: README.md (1048576)"

[[test.example-argument-parse]]
command = "strict-transfer"
expect.exit-code = 0
expect.result = "Error: name is not provided"

[[test.example-async-support]]
command = "download readme.txt"
expect.exit-code = 0
expect.result = "\"readme.txt\" downloaded."

[[test.example-custom-pickable]]
command = "connect 192.168.1.1:8080"
expect.exit-code = 0
expect.result = "Connected to \"192.168.1.1:8080\""

[[test.example-custom-pickable]]
command = "connect"
expect.exit-code = 0
expect.result = "Failed to parse address"

[[test.example-custom-pickable]]
command = "connect invalid"
expect.exit-code = 0
expect.result = "Failed to parse address"

[[test.example-dispatch-tree]]
command = "cmd5"
expect.exit-code = 0
expect.result = "It's works!"

[[test.example-enum-tag]]
command = "lang-select"
expect.exit-code = 0
expect.result = "Selected: Rust"

[[test.example-enum-tag]]
command = "lang-select Python"
expect.exit-code = 0
expect.result = "Selected: Python"

[[test.example-enum-tag]]
command = "lang-select OCaml"
expect.exit-code = 0
expect.result = "Selected: OCaml"

[[test.example-general-renderer]]
command = "render Bob 22"
expect.exit-code = 0
expect.result = "Bob is 22 years old"

[[test.example-general-renderer]]
command = "render Bob 22 --json"
expect.exit-code = 0
expect.result = "{\"member_name\":\"Bob\",\"member_age\":22}"

[[test.example-help]]
command = "greet"
expect.exit-code = 0
expect.result = ""

[[test.example-help]]
command = "greet --help"
expect.exit-code = 0
expect.result = "Usage: greet <NAME>"

[[test.example-hook]]
command = "greet"
expect.exit-code = 0
expect.result = "Hello, World!"

[[test.example-hook]]
command = "greet Alice"
expect.exit-code = 0
expect.result = "Hello, Alice!"

[[test.example-panic-unwind]]
command = "panic"
expect.exit-code = 0
expect.result = "Program not panic"

[[test.example-panic-unwind]]
command = "panic something_went_wrong"
expect.exit-code = 0
expect.result = "Program panic: something_went_wrong"

[[test.example-resources]]
command = "current"
expect.exit-code = 0
expect.result = "Current directory:"

[[test.example-setup]]
command = "1"
expect.exit-code = 0
expect.result = ""

[[test.example-setup]]
command = "2"
expect.exit-code = 0
expect.result = ""

[[test.example-setup]]
command = "3"
expect.exit-code = 0
expect.result = ""

[[test.example-setup]]
command = "4"
expect.exit-code = 0
expect.result = ""

[[test.example-setup]]
command = "5"
expect.exit-code = 0
expect.result = ""

[[test.example-completion]]
command = "greet World --repeat 1"
expect.exit-code = 0
expect.result = "Hello, World!"

[[test.example-clap-binding]]
command = "greet"
expect.exit-code = 0
expect.result = "Hello, World!"

[[test.example-clap-binding]]
command = "greet Alice"
expect.exit-code = 0
expect.result = "Hello, Alice!"

[[test.example-clap-binding]]
command = "greet Alice -r 5"
expect.exit-code = 0
expect.result = "Hello, Alice, Alice, Alice, Alice, Alice!"