forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargv_test.js
80 lines (67 loc) · 1.1 KB
/
argv_test.js
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
'use strict';
var Arg = require("../../lib/js/arg.js");
function anno_fun(arg) {
}
var usage_msg = "Usage:\n";
var compile = {
contents: false
};
var test = {
contents: true
};
var arg_spec_0 = [
"-c",
{
TAG: /* Set */2,
_0: compile
},
" Compile"
];
var arg_spec_1 = {
hd: [
"-d",
{
TAG: /* Clear */3,
_0: test
},
" Test"
],
tl: /* [] */0
};
var arg_spec = {
hd: arg_spec_0,
tl: arg_spec_1
};
Arg.parse_argv(undefined, [
"prog.exe",
"-c",
"-d"
], arg_spec, anno_fun, usage_msg);
if (compile.contents !== true) {
throw {
RE_EXN_ID: "Assert_failure",
_1: [
"argv_test.ml",
20,
0
],
Error: new Error()
};
}
if (test.contents !== false) {
throw {
RE_EXN_ID: "Assert_failure",
_1: [
"argv_test.ml",
21,
0
],
Error: new Error()
};
}
exports.anno_fun = anno_fun;
exports.usage_msg = usage_msg;
exports.compile = compile;
exports.test = test;
exports.arg_spec = arg_spec;
/* Not a pure module */