@@ -22,9 +22,7 @@ const cliHelp =
22
22
"\n" +
23
23
"Run `rescript <subcommand> -h` for subcommand help. Examples:\n" +
24
24
" rescript build -h\n" +
25
- " rescript format -h\n" +
26
- "The default `rescript` is equivalent to `rescript build` subcommand\n" +
27
- "\n" ;
25
+ " rescript format -h\n" ;
28
26
29
27
const buildHelp =
30
28
"Usage: rescript build <options> -- <ninja_options>\n" +
@@ -105,7 +103,7 @@ out = child_process.spawnSync(`../../../rescript`, ["build", "-wtf"], {
105
103
encoding : "utf8" ,
106
104
cwd : __dirname ,
107
105
} ) ;
108
- assert . equal ( out . stderr , " Error: unknown option: ' -wtf' .\n" + buildHelp + "\n" ) ;
106
+ assert . equal ( out . stderr , ' Error: Unknown option " -wtf" .\n' + buildHelp + "\n" ) ;
109
107
assert . equal ( out . status , 2 ) ;
110
108
111
109
// Shows cli help with --help arg
@@ -114,8 +112,7 @@ out = child_process.spawnSync(`../../../rescript`, ["--help"], {
114
112
cwd : __dirname ,
115
113
} ) ;
116
114
assert . equal ( out . stdout , cliHelp ) ;
117
- // FIXME: Should be 0
118
- assert . equal ( out . status , 2 ) ;
115
+ assert . equal ( out . status , 0 ) ;
119
116
120
117
// Shows cli help with -h arg
121
118
out = child_process . spawnSync ( `../../../rescript` , [ "-h" ] , {
@@ -138,19 +135,15 @@ out = child_process.spawnSync(`../../../rescript`, ["built"], {
138
135
encoding : "utf8" ,
139
136
cwd : __dirname ,
140
137
} ) ;
141
- // Should write to stderr instead ???
142
- assert . equal ( out . stdout , cliHelp ) ;
143
- // FIXME: Should show a warning that it's an unknown command
138
+ assert . equal ( out . stderr , `Error: Unknown command or flag "built".\n` + cliHelp ) ;
144
139
assert . equal ( out . status , 2 ) ;
145
140
146
141
// Shows cli help with unknown args
147
142
out = child_process . spawnSync ( `../../../rescript` , [ "-w" ] , {
148
143
encoding : "utf8" ,
149
144
cwd : __dirname ,
150
145
} ) ;
151
- // Should write to stderr instead ???
152
- assert . equal ( out . stdout , cliHelp ) ;
153
- // FIXME: Should show a warning that it's an unknown arg
146
+ assert . equal ( out . stderr , `Error: Unknown command or flag "-w".\n` + cliHelp ) ;
154
147
assert . equal ( out . status , 2 ) ;
155
148
156
149
// Shows clean help with --help arg
@@ -174,7 +167,7 @@ out = child_process.spawnSync(`../../../rescript`, ["clean", "-wtf"], {
174
167
encoding : "utf8" ,
175
168
cwd : __dirname ,
176
169
} ) ;
177
- assert . equal ( out . stderr , " Error: unknown option: ' -wtf' .\n" + cleanHelp + "\n" ) ;
170
+ assert . equal ( out . stderr , ' Error: Unknown option " -wtf" .\n' + cleanHelp + "\n" ) ;
178
171
assert . equal ( out . status , 2 ) ;
179
172
180
173
// Shows format help with --help arg
0 commit comments