@@ -80,41 +80,58 @@ let out = child_process.spawnSync(`../../../rescript`, ["build", "--help"], {
80
80
cwd : __dirname ,
81
81
} ) ;
82
82
assert . equal ( out . stdout , buildHelp ) ;
83
+ assert . equal ( out . status , 0 ) ;
84
+
85
+ // Shows build help with --help arg
86
+ out = child_process . spawnSync ( `../../../rescript` , [ "build" , "-w" , "--help" ] , {
87
+ encoding : "utf8" ,
88
+ cwd : __dirname ,
89
+ } ) ;
90
+ // FIXME: Shouldn't have "Start compiling" for help
91
+ assert . equal ( out . stdout , ">>>> Start compiling\n" + buildHelp ) ;
92
+ // FIXME: Should be 0
93
+ assert . equal ( out . status , 1 ) ;
83
94
84
95
// Shows build help with -h arg
85
96
out = child_process . spawnSync ( `../../../rescript` , [ "build" , "-h" ] , {
86
97
encoding : "utf8" ,
87
98
cwd : __dirname ,
88
99
} ) ;
89
100
assert . equal ( out . stdout , buildHelp ) ;
101
+ assert . equal ( out . status , 0 ) ;
90
102
91
103
// Exits with build help with unknown arg
92
104
out = child_process . spawnSync ( `../../../rescript` , [ "build" , "-wtf" ] , {
93
105
encoding : "utf8" ,
94
106
cwd : __dirname ,
95
107
} ) ;
96
108
assert . equal ( out . stderr , "Error: unknown option: '-wtf'.\n" + buildHelp + "\n" ) ;
109
+ assert . equal ( out . status , 2 ) ;
97
110
98
111
// Shows cli help with --help arg
99
112
out = child_process . spawnSync ( `../../../rescript` , [ "--help" ] , {
100
113
encoding : "utf8" ,
101
114
cwd : __dirname ,
102
115
} ) ;
103
116
assert . equal ( out . stdout , cliHelp ) ;
117
+ // FIXME: Should be 0
118
+ assert . equal ( out . status , 2 ) ;
104
119
105
120
// Shows cli help with -h arg
106
121
out = child_process . spawnSync ( `../../../rescript` , [ "-h" ] , {
107
122
encoding : "utf8" ,
108
123
cwd : __dirname ,
109
124
} ) ;
110
125
assert . equal ( out . stdout , cliHelp ) ;
126
+ assert . equal ( out . status , 0 ) ;
111
127
112
128
// Shows cli help with help command
113
129
out = child_process . spawnSync ( `../../../rescript` , [ "help" ] , {
114
130
encoding : "utf8" ,
115
131
cwd : __dirname ,
116
132
} ) ;
117
133
assert . equal ( out . stdout , cliHelp ) ;
134
+ assert . equal ( out . status , 0 ) ;
118
135
119
136
// Shows cli help with unknown command
120
137
out = child_process . spawnSync ( `../../../rescript` , [ "built" ] , {
@@ -123,6 +140,8 @@ out = child_process.spawnSync(`../../../rescript`, ["built"], {
123
140
} ) ;
124
141
// Should write to stderr instead ???
125
142
assert . equal ( out . stdout , cliHelp ) ;
143
+ // FIXME: Should show a warning that it's an unknown command
144
+ assert . equal ( out . status , 2 ) ;
126
145
127
146
// Shows cli help with unknown args
128
147
out = child_process . spawnSync ( `../../../rescript` , [ "-w" ] , {
@@ -131,27 +150,32 @@ out = child_process.spawnSync(`../../../rescript`, ["-w"], {
131
150
} ) ;
132
151
// Should write to stderr instead ???
133
152
assert . equal ( out . stdout , cliHelp ) ;
153
+ // FIXME: Should show a warning that it's an unknown arg
154
+ assert . equal ( out . status , 2 ) ;
134
155
135
156
// Shows clean help with --help arg
136
157
out = child_process . spawnSync ( `../../../rescript` , [ "clean" , "--help" ] , {
137
158
encoding : "utf8" ,
138
159
cwd : __dirname ,
139
160
} ) ;
140
161
assert . equal ( out . stdout , cleanHelp ) ;
162
+ assert . equal ( out . status , 0 ) ;
141
163
142
164
// Shows clean help with -h arg
143
165
out = child_process . spawnSync ( `../../../rescript` , [ "clean" , "-h" ] , {
144
166
encoding : "utf8" ,
145
167
cwd : __dirname ,
146
168
} ) ;
147
169
assert . equal ( out . stdout , cleanHelp ) ;
170
+ assert . equal ( out . status , 0 ) ;
148
171
149
172
// Exits with clean help with unknown arg
150
173
out = child_process . spawnSync ( `../../../rescript` , [ "clean" , "-wtf" ] , {
151
174
encoding : "utf8" ,
152
175
cwd : __dirname ,
153
176
} ) ;
154
177
assert . equal ( out . stderr , "Error: unknown option: '-wtf'.\n" + cleanHelp + "\n" ) ;
178
+ assert . equal ( out . status , 2 ) ;
155
179
156
180
// Shows format help with --help arg
157
181
out = child_process . spawnSync ( `../../../rescript` , [ "format" , "--help" ] , {
@@ -160,6 +184,7 @@ out = child_process.spawnSync(`../../../rescript`, ["format", "--help"], {
160
184
} ) ;
161
185
// Note: it writes to stderr
162
186
assert . equal ( out . stderr , formatHelp ) ;
187
+ assert . equal ( out . status , 0 ) ;
163
188
164
189
// Shows format help with -h arg
165
190
out = child_process . spawnSync ( `../../../rescript` , [ "format" , "-h" ] , {
@@ -168,6 +193,7 @@ out = child_process.spawnSync(`../../../rescript`, ["format", "-h"], {
168
193
} ) ;
169
194
// Note: it writes to stderr
170
195
assert . equal ( out . stderr , formatHelp ) ;
196
+ assert . equal ( out . status , 0 ) ;
171
197
172
198
// Shows convert help with --help arg
173
199
out = child_process . spawnSync ( `../../../rescript` , [ "convert" , "--help" ] , {
@@ -176,6 +202,7 @@ out = child_process.spawnSync(`../../../rescript`, ["convert", "--help"], {
176
202
} ) ;
177
203
// Note: it writes to stderr
178
204
assert . equal ( out . stderr , convertHelp ) ;
205
+ assert . equal ( out . status , 0 ) ;
179
206
180
207
// Shows convert help with -h arg
181
208
out = child_process . spawnSync ( `../../../rescript` , [ "convert" , "-h" ] , {
@@ -184,6 +211,7 @@ out = child_process.spawnSync(`../../../rescript`, ["convert", "-h"], {
184
211
} ) ;
185
212
// Note: it writes to stderr
186
213
assert . equal ( out . stderr , convertHelp ) ;
214
+ assert . equal ( out . status , 0 ) ;
187
215
188
216
// Shows dump help with --help arg
189
217
out = child_process . spawnSync ( `../../../rescript` , [ "dump" , "--help" ] , {
@@ -192,6 +220,7 @@ out = child_process.spawnSync(`../../../rescript`, ["dump", "--help"], {
192
220
} ) ;
193
221
// Note: it writes to stderr
194
222
assert . equal ( out . stderr , dumpHelp ) ;
223
+ assert . equal ( out . status , 0 ) ;
195
224
196
225
// Shows dump help with -h arg
197
226
out = child_process . spawnSync ( `../../../rescript` , [ "dump" , "-h" ] , {
@@ -200,3 +229,4 @@ out = child_process.spawnSync(`../../../rescript`, ["dump", "-h"], {
200
229
} ) ;
201
230
// Note: it writes to stderr
202
231
assert . equal ( out . stderr , dumpHelp ) ;
232
+ assert . equal ( out . status , 0 ) ;
0 commit comments