Skip to content

Commit 88b628b

Browse files
authored
Merge pull request #17 from cknitt/feature/alcotest
Alcotest.
2 parents b9d9c5f + a038aa7 commit 88b628b

File tree

14 files changed

+280
-5930
lines changed

14 files changed

+280
-5930
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ install:
99
- esy install
1010
script:
1111
- esy build
12-
- cd tests
13-
- npm install
14-
- npm test
12+
- _build/default/test/Test.exe

esy.lock.json

Lines changed: 165 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"hash": "27595da2deeb485b638f9f6b07cbbc85",
2+
"hash": "9350b216342c05f38ce9761259bd3807",
33
"root": "bs-react-intl-extractor@path:.",
44
"node": {
55
"refmterr@3.1.7": {
@@ -37,8 +37,8 @@
3737
},
3838
"dependencies": [
3939
"@esy-ocaml/merlin@3.0.5005", "@esy-ocaml/reason@3.3.3",
40-
"@opam/dune@opam:1.1.1", "@opam/yojson@opam:1.4.1", "ocaml@4.6.5",
41-
"refmterr@3.1.7"
40+
"@opam/alcotest@opam:0.8.3", "@opam/dune@opam:1.1.1",
41+
"@opam/yojson@opam:1.4.1", "ocaml@4.6.5", "refmterr@3.1.7"
4242
]
4343
},
4444
"@opam/yojson@opam:1.4.1": {
@@ -64,6 +64,49 @@
6464
"@opam/jbuilder@opam:transition"
6565
]
6666
},
67+
"@opam/uchar@opam:0.0.2": {
68+
"record": {
69+
"name": "@opam/uchar",
70+
"version": "opam:0.0.2",
71+
"source": [
72+
"archive:https://opam.ocaml.org/archives/uchar.0.0.2+opam.tar.gz#md5:a4754e44371178a883821e664f644b19",
73+
"archive:https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz#md5:c9ba2c738d264c420c642f7bb1cf4a36"
74+
],
75+
"files": [],
76+
"opam": {
77+
"name": "uchar",
78+
"version": "0.0.2",
79+
"opam":
80+
"opam-version: \"1.2\"\nname: \"uchar\"\nversion: \"0.0.2\"\nmaintainer: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nauthors: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nlicense: \"typeof OCaml system\"\ntags: [\"text\" \"character\" \"unicode\" \"compatibility\" \"org:ocaml.org\"]\nhomepage: \"http://ocaml.org\"\ndoc: \"https://ocaml.github.io/uchar/\"\nbug-reports: \"https://github.com/ocaml/uchar/issues\"\ndepends: [\n \"ocamlbuild\" {build}\n]\navailable: ocaml-version >= \"3.12.0\"\nbuild: [\n [\"ocaml\" \"pkg/git.ml\"]\n [\n \"ocaml\"\n \"pkg/build.ml\"\n \"native=%{ocaml-native}%\"\n \"native-dynlink=%{ocaml-native-dynlink}%\"\n ]\n]\ndev-repo: \"git+https://github.com/ocaml/uchar.git\"",
81+
"override": null
82+
}
83+
},
84+
"dependencies": [
85+
"@esy-ocaml/substs@0.0.1", "@opam/ocamlbuild@opam:0.12.0"
86+
]
87+
},
88+
"@opam/topkg@opam:0.9.1": {
89+
"record": {
90+
"name": "@opam/topkg",
91+
"version": "opam:0.9.1",
92+
"source": [
93+
"archive:https://opam.ocaml.org/archives/topkg.0.9.1+opam.tar.gz#md5:1ec2522f346d19bf4c24c3c0b2e3e8bd",
94+
"archive:http://erratique.ch/software/topkg/releases/topkg-0.9.1.tbz#md5:8978a0595db1a22e4251ec62735d4b84"
95+
],
96+
"files": [],
97+
"opam": {
98+
"name": "topkg",
99+
"version": "0.9.1",
100+
"opam":
101+
"opam-version: \"1.2\"\nname: \"topkg\"\nversion: \"0.9.1\"\nmaintainer: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nauthors: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nlicense: \"ISC\"\ntags: [\"packaging\" \"ocamlbuild\" \"org:erratique\"]\nhomepage: \"http://erratique.ch/software/topkg\"\ndoc: \"http://erratique.ch/software/topkg/doc\"\nbug-reports: \"https://github.com/dbuenzli/topkg/issues\"\ndepends: [\n \"ocamlfind\" {build & >= \"1.6.1\"}\n \"ocamlbuild\"\n \"result\"\n]\navailable: ocaml-version >= \"4.01.0\"\nbuild: [\n \"ocaml\" \"pkg/pkg.ml\" \"build\" \"--pkg-name\" name \"--dev-pkg\" \"%{pinned}%\"\n]\ndev-repo: \"git+http://erratique.ch/repos/topkg.git\"",
102+
"override": null
103+
}
104+
},
105+
"dependencies": [
106+
"@esy-ocaml/substs@0.0.1", "@opam/ocamlbuild@opam:0.12.0",
107+
"@opam/ocamlfind@opam:1.8.0", "@opam/result@opam:1.3"
108+
]
109+
},
67110
"@opam/seq@opam:0.1": {
68111
"record": {
69112
"name": "@opam/seq",
@@ -284,21 +327,39 @@
284327
"@opam/ocamlfind@opam:1.8.0"
285328
]
286329
},
287-
"@opam/menhir@opam:20170509": {
330+
"@opam/menhir@opam:20170712": {
288331
"record": {
289332
"name": "@opam/menhir",
290-
"version": "opam:20170509",
333+
"version": "opam:20170712",
291334
"source": [
292-
"archive:https://opam.ocaml.org/archives/menhir.20170509+opam.tar.gz#md5:0ad65a00cb3c02587fba9048af8d84b9",
293-
"archive:http://gallium.inria.fr/~fpottier/menhir/menhir-20170509.tar.gz#md5:b8ba18b5abda831cf41cd4fa65f4c51b"
335+
"archive:https://opam.ocaml.org/archives/menhir.20170712+opam.tar.gz#md5:18aaf814e51aeb4fbfd8b7c1fb7ffbba",
336+
"archive:http://gallium.inria.fr/~fpottier/menhir/menhir-20170712.tar.gz#md5:85a5c2aef1d3f2224dab7c53d79892e5"
337+
],
338+
"files": [
339+
{
340+
"name": "_esy/menhir-20170712.patch",
341+
"content":
342+
"--- ./Makefile\n+++ ./Makefile\n@@ -60,10 +60,11 @@\n # If the compiler is MSVC, then the name of the executable file ends in .exe,\n # and object file names end in .obj instead of .o.\n \n-ifneq (,$(shell ocamlc -config | grep -E \"ccomp_type: msvc\"))\n+OS_TYPE:=$(shell ocamlc -config | tr -d '\\15' | awk '/^os_type:/ {print $$2}')\n+ifeq ($(OS_TYPE),$(filter $(OS_TYPE),Win32 Cygwin))\n MENHIREXE := menhir.exe\n- OBJ := obj\n-# LIBSUFFIX := lib\n+ OBJ := $(shell ocamlc -config | tr -d '\\15' | awk '/^ext_obj:/ {print $$2}' | tr -d '.')\n+# LIBSUFFIX := $(shell ocamlc -config | tr -d '\\15' | awk '/^ext_lib:/ {print $$2}' | tr -d '.')\n else\n MENHIREXE := menhir\n OBJ := o\n@@ -85,8 +86,8 @@\n # performed if \"os_type\" is \"Win32\" or \"Win64\", and must not be performed if\n # \"os_type\" is \"Cygwin\" or \"Unix\".\n \n-ifneq (,$(shell ocamlc -config | grep -E \"os_type: (Win32|Win64)\"))\n-installation_libdir := $(shell cygpath -m $(libdir))\n+ifeq ($(OS_TYPE),Win32)\n+installation_libdir := $(shell cygpath -m $(libdir) || echo $(libdir))\n else\n installation_libdir := $(libdir)\n endif\n--- ./src/cmly_write.ml\n+++ ./src/cmly_write.ml\n@@ -168,6 +168,6 @@\n output_value oc (t : grammar)\n \n let write filename =\n- let oc = open_out filename in\n+ let oc = open_out_bin filename in\n write oc (encode());\n close_out oc\n"
343+
}
294344
],
295-
"files": [],
296345
"opam": {
297346
"name": "menhir",
298-
"version": "20170509",
347+
"version": "20170712",
299348
"opam":
300-
"opam-version: \"1.2\"\nname: \"menhir\"\nversion: \"20170509\"\nmaintainer: \"francois.pottier@inria.fr\"\nauthors: [\n \"François Pottier <francois.pottier@inria.fr>\"\n \"Yann Régis-Gianas <yrg@pps.univ-paris-diderot.fr>\"\n]\nhomepage: \"http://gallium.inria.fr/~fpottier/menhir/\"\nbug-reports: \"menhir@inria.fr\"\ndepends: [\n \"ocamlfind\"\n \"ocamlbuild\" {build}\n]\navailable: ocaml-version >= \"4.02\"\nbuild: [\n make\n \"-f\"\n \"Makefile\"\n \"PREFIX=%{prefix}%\"\n \"USE_OCAMLFIND=true\"\n \"docdir=%{doc}%/menhir\"\n \"libdir=%{lib}%/menhir\"\n \"mandir=%{man}%/man1\"\n]\ninstall: [\n make\n \"-f\"\n \"Makefile\"\n \"install\"\n \"PREFIX=%{prefix}%\"\n \"docdir=%{doc}%/menhir\"\n \"libdir=%{lib}%/menhir\"\n \"mandir=%{man}%/man1\"\n]\nremove: [\n make\n \"-f\"\n \"Makefile\"\n \"uninstall\"\n \"PREFIX=%{prefix}%\"\n \"docdir=%{doc}%/menhir\"\n \"libdir=%{lib}%/menhir\"\n \"mandir=%{man}%/man1\"\n]\ndev-repo: \"git+https://gitlab.inria.fr/fpottier/menhir.git\"",
301-
"override": null
349+
"opam-version: \"1.2\"\nname: \"menhir\"\nversion: \"20170712\"\nmaintainer: \"francois.pottier@inria.fr\"\nauthors: [\n \"François Pottier <francois.pottier@inria.fr>\"\n \"Yann Régis-Gianas <yrg@pps.univ-paris-diderot.fr>\"\n]\nhomepage: \"http://gallium.inria.fr/~fpottier/menhir/\"\nbug-reports: \"menhir@inria.fr\"\ndepends: [\n \"ocamlfind\"\n \"ocamlbuild\" {build}\n]\navailable: ocaml-version >= \"4.02\"\nbuild: [\n make\n \"-f\"\n \"Makefile\"\n \"PREFIX=%{prefix}%\"\n \"USE_OCAMLFIND=true\"\n \"docdir=%{doc}%/menhir\"\n \"libdir=%{lib}%/menhir\"\n \"mandir=%{man}%/man1\"\n]\ninstall: [\n make\n \"-f\"\n \"Makefile\"\n \"install\"\n \"PREFIX=%{prefix}%\"\n \"docdir=%{doc}%/menhir\"\n \"libdir=%{lib}%/menhir\"\n \"mandir=%{man}%/man1\"\n]\nremove: [\n make\n \"-f\"\n \"Makefile\"\n \"uninstall\"\n \"PREFIX=%{prefix}%\"\n \"docdir=%{doc}%/menhir\"\n \"libdir=%{lib}%/menhir\"\n \"mandir=%{man}%/man1\"\n]\ndev-repo: \"git+https://gitlab.inria.fr/fpottier/menhir.git\"",
350+
"override": {
351+
"build": [
352+
[
353+
"bash", "-c",
354+
"#{os == 'windows' ? 'patch -p1 < _esy/menhir-20170712.patch' : 'true'}"
355+
],
356+
[
357+
"make", "-f", "Makefile", "PREFIX=#{self.install}",
358+
"USE_OCAMLFIND=true", "docdir=#{self.doc}/menhir",
359+
"libdir=#{self.lib}/menhir", "mandir=#{self.man}/man1"
360+
]
361+
]
362+
}
302363
}
303364
},
304365
"dependencies": [
@@ -325,6 +386,29 @@
325386
"@opam/ocamlfind@opam:1.8.0"
326387
]
327388
},
389+
"@opam/fmt@opam:0.8.5": {
390+
"record": {
391+
"name": "@opam/fmt",
392+
"version": "opam:0.8.5",
393+
"source": [
394+
"archive:https://opam.ocaml.org/archives/fmt.0.8.5+opam.tar.gz#md5:7d36eb6998bfbd93d497f5cd0b32ddfc",
395+
"archive:http://erratique.ch/software/fmt/releases/fmt-0.8.5.tbz#md5:77b64aa6f20f09de28f2405d6195f12c"
396+
],
397+
"files": [],
398+
"opam": {
399+
"name": "fmt",
400+
"version": "0.8.5",
401+
"opam":
402+
"opam-version: \"1.2\"\nname: \"fmt\"\nversion: \"0.8.5\"\nmaintainer: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nauthors: [\"Daniel Bünzli <daniel.buenzl i@erratique.ch>\" \"Gabriel Radanne\"]\nlicense: \"ISC\"\ntags: [\"string\" \"format\" \"pretty-print\" \"org:erratique\"]\nhomepage: \"http://erratique.ch/software/fmt\"\ndoc: \"http://erratique.ch/software/fmt\"\nbug-reports: \"https://github.com/dbuenzli/fmt/issues\"\ndepends: [\n \"ocamlfind\" {build}\n \"ocamlbuild\" {build}\n \"topkg\" {build & >= \"0.9.0\"}\n \"result\"\n \"uchar\"\n]\ndepopts: [\"base-unix\" \"cmdliner\"]\nconflicts: [\n \"cmdliner\" {< \"0.9.8\"}\n]\navailable: ocaml-version >= \"4.01.0\"\nbuild: [\n \"ocaml\"\n \"pkg/pkg.ml\"\n \"build\"\n \"--dev-pkg\"\n \"%{pinned}%\"\n \"--with-base-unix\"\n \"%{base-unix:installed}%\"\n \"--with-cmdliner\"\n \"%{cmdliner:installed}%\"\n]\ndev-repo: \"git+http://erratique.ch/repos/fmt.git\"",
403+
"override": null
404+
}
405+
},
406+
"dependencies": [
407+
"@esy-ocaml/substs@0.0.1", "@opam/ocamlbuild@opam:0.12.0",
408+
"@opam/ocamlfind@opam:1.8.0", "@opam/result@opam:1.3",
409+
"@opam/topkg@opam:0.9.1", "@opam/uchar@opam:0.0.2"
410+
]
411+
},
328412
"@opam/easy-format@opam:1.3.1": {
329413
"record": {
330414
"name": "@opam/easy-format",
@@ -424,6 +508,29 @@
424508
},
425509
"dependencies": [ "@esy-ocaml/substs@0.0.1" ]
426510
},
511+
"@opam/cmdliner@opam:1.0.2": {
512+
"record": {
513+
"name": "@opam/cmdliner",
514+
"version": "opam:1.0.2",
515+
"source": [
516+
"archive:https://opam.ocaml.org/archives/cmdliner.1.0.2+opam.tar.gz#md5:b3f734417099fa5d9198bc927b12873f",
517+
"archive:http://erratique.ch/software/cmdliner/releases/cmdliner-1.0.2.tbz#md5:ab2f0130e88e8dcd723ac6154c98a881"
518+
],
519+
"files": [],
520+
"opam": {
521+
"name": "cmdliner",
522+
"version": "1.0.2",
523+
"opam":
524+
"opam-version: \"1.2\"\nname: \"cmdliner\"\nversion: \"1.0.2\"\nmaintainer: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nauthors: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nlicense: \"ISC\"\ntags: [\"cli\" \"system\" \"declarative\" \"org:erratique\"]\nhomepage: \"http://erratique.ch/software/cmdliner\"\ndoc: \"http://erratique.ch/software/cmdliner/doc/Cmdliner\"\nbug-reports: \"https://github.com/dbuenzli/cmdliner/issues\"\ndepends: [\n \"ocamlfind\" {build}\n \"ocamlbuild\" {build}\n \"topkg\" {build}\n \"result\"\n]\navailable: ocaml-version >= \"4.01.0\"\nbuild: [\"ocaml\" \"pkg/pkg.ml\" \"build\" \"--pinned\" \"%{pinned}%\"]\ndev-repo: \"git+http://erratique.ch/repos/cmdliner.git\"",
525+
"override": null
526+
}
527+
},
528+
"dependencies": [
529+
"@esy-ocaml/substs@0.0.1", "@opam/ocamlbuild@opam:0.12.0",
530+
"@opam/ocamlfind@opam:1.8.0", "@opam/result@opam:1.3",
531+
"@opam/topkg@opam:0.9.1"
532+
]
533+
},
427534
"@opam/biniou@opam:1.2.0": {
428535
"record": {
429536
"name": "@opam/biniou",
@@ -480,6 +587,52 @@
480587
"@esy-ocaml/substs@0.0.1", "@opam/ocamlfind@opam:1.8.0"
481588
]
482589
},
590+
"@opam/astring@opam:0.8.3": {
591+
"record": {
592+
"name": "@opam/astring",
593+
"version": "opam:0.8.3",
594+
"source": [
595+
"archive:https://opam.ocaml.org/archives/astring.0.8.3+opam.tar.gz#md5:e2fe279530a6602caa413dba36889254",
596+
"archive:http://erratique.ch/software/astring/releases/astring-0.8.3.tbz#md5:c5bf6352b9ac27fbeab342740f4fa870"
597+
],
598+
"files": [],
599+
"opam": {
600+
"name": "astring",
601+
"version": "0.8.3",
602+
"opam":
603+
"opam-version: \"1.2\"\nname: \"astring\"\nversion: \"0.8.3\"\nmaintainer: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nauthors: \"Daniel Bünzli <daniel.buenzl i@erratique.ch>\"\nlicense: \"ISC\"\ntags: [\"string\" \"org:erratique\"]\nhomepage: \"http://erratique.ch/software/astring\"\ndoc: \"http://erratique.ch/software/astring/doc\"\nbug-reports: \"https://github.com/dbuenzli/astring/issues\"\ndepends: [\n \"ocamlfind\" {build}\n \"ocamlbuild\" {build}\n \"topkg\" {build}\n \"base-bytes\"\n]\navailable: ocaml-version >= \"4.01.0\"\nbuild: [\"ocaml\" \"pkg/pkg.ml\" \"build\" \"--pinned\" \"%{pinned}%\"]\ndev-repo: \"git+http://erratique.ch/repos/astring.git\"",
604+
"override": null
605+
}
606+
},
607+
"dependencies": [
608+
"@esy-ocaml/substs@0.0.1", "@opam/base-bytes@opam:base",
609+
"@opam/ocamlbuild@opam:0.12.0", "@opam/ocamlfind@opam:1.8.0",
610+
"@opam/topkg@opam:0.9.1"
611+
]
612+
},
613+
"@opam/alcotest@opam:0.8.3": {
614+
"record": {
615+
"name": "@opam/alcotest",
616+
"version": "opam:0.8.3",
617+
"source": [
618+
"archive:https://opam.ocaml.org/archives/alcotest.0.8.3+opam.tar.gz#md5:42c64ffe49d8bd56bb93bf339efb199b",
619+
"archive:https://github.com/mirage/alcotest/releases/download/0.8.3/alcotest-0.8.3.tbz#md5:597e6bb271bd42062f95aa67afdb9185"
620+
],
621+
"files": [],
622+
"opam": {
623+
"name": "alcotest",
624+
"version": "0.8.3",
625+
"opam":
626+
"opam-version: \"1.2\"\nname: \"alcotest\"\nversion: \"0.8.3\"\nmaintainer: \"thomas@gazagnaire.org\"\nauthors: \"Thomas Gazagnaire\"\nlicense: \"ISC\"\nhomepage: \"https://github.com/mirage/alcotest/\"\ndoc: \"https://mirage.github.io/alcotest/\"\nbug-reports: \"https://github.com/mirage/alcotest/issues/\"\ndepends: [\n \"jbuilder\" {build & >= \"1.0+beta10\"}\n \"fmt\" {>= \"0.8.0\"}\n \"astring\"\n \"result\"\n \"cmdliner\"\n]\navailable: ocaml-version >= \"4.02.3\"\nbuild: [\n [\"jbuilder\" \"subst\" \"-p\" name] {pinned}\n [\"jbuilder\" \"build\" \"-p\" name \"-j\" jobs]\n]\nrun-test: [\"jbuilder\" \"runtest\" \"-p\" name \"-j\" jobs]\ndev-repo: \"git+https://github.com/mirage/alcotest.git\"",
627+
"override": null
628+
}
629+
},
630+
"dependencies": [
631+
"@esy-ocaml/substs@0.0.1", "@opam/astring@opam:0.8.3",
632+
"@opam/cmdliner@opam:1.0.2", "@opam/fmt@opam:0.8.5",
633+
"@opam/jbuilder@opam:transition", "@opam/result@opam:1.3"
634+
]
635+
},
483636
"@esy-ocaml/substs@0.0.1": {
484637
"record": {
485638
"name": "@esy-ocaml/substs",
@@ -502,7 +655,7 @@
502655
},
503656
"dependencies": [
504657
"@esy-ocaml/esy-installer@0.0.0", "@esy-ocaml/substs@0.0.1",
505-
"@opam/jbuilder@opam:transition", "@opam/menhir@opam:20170509",
658+
"@opam/jbuilder@opam:transition", "@opam/menhir@opam:20170712",
506659
"@opam/merlin-extend@opam:0.3",
507660
"@opam/ocaml-migrate-parsetree@opam:1.0.11",
508661
"@opam/ocamlfind@opam:1.8.0", "@opam/result@opam:1.3"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@esy-ocaml/reason": "^3.3.3",
21+
"@opam/alcotest": "0.8.3",
2122
"@opam/dune": "^1.1.1",
2223
"@opam/yojson": "^1.4.1",
2324
"ocaml": "~4.6.1",

test/CmdLine.re

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let res = Alcotest.(pair(string, string));
2+
3+
/* Make fast pipe available. */
4+
let (|.) = (a, b) => b(a);
5+
6+
let getChannelContents = channel => {
7+
open Buffer;
8+
9+
let buf = create(1024);
10+
try (
11+
while (true) {
12+
buf->add_string(input_line(channel));
13+
buf->add_string("\n");
14+
}
15+
) {
16+
| End_of_file => ()
17+
};
18+
19+
buf->contents;
20+
};
21+
22+
let run = params => {
23+
let (in_, out, err) = Unix.open_process_full("_build/default/bin/Extract.exe " ++ params, [||]);
24+
25+
let res = (getChannelContents(in_), getChannelContents(err));
26+
27+
Unix.close_process_full((in_, out, err)) |> ignore;
28+
29+
res;
30+
};

test/Test.re

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
let checkRes = (params, expected) => {
2+
let res = CmdLine.run(params);
3+
Alcotest.check(CmdLine.res, "res", expected, res);
4+
};
5+
6+
module Usage = {
7+
let usage = "Usage: _build/default/bin/Extract.exe [path...]
8+
-v shows the program version
9+
-help Display this list of options
10+
--help Display this list of options
11+
";
12+
13+
let testNoArgs = () => checkRes("", ("", usage));
14+
let testHelp = () => checkRes("-help", (usage, ""));
15+
16+
let testSet = [("No args", `Quick, testNoArgs), ("Help", `Quick, testHelp)];
17+
};
18+
19+
module Version = {
20+
let version = "0.5.0";
21+
22+
let testVersion = () => checkRes("-v", (version ++ "\n", ""));
23+
24+
let testSet = [("Version", `Quick, testVersion)];
25+
};
26+
27+
module Extract = {
28+
let full = {|[
29+
{ "id": "test1.msg1.1", "defaultMessage": "This is message 1.1" },
30+
{ "id": "test1.msg1.2", "defaultMessage": "This is message 1.2" },
31+
{
32+
"id": "test1.msg1.3",
33+
"defaultMessage": "This is message 1.3",
34+
"description": "Description for message 1.3"
35+
},
36+
{ "id": "test1.msg1.4", "defaultMessage": "This is message 1.4" },
37+
{ "id": "test1.msg1.5", "defaultMessage": "This is message 1.5" },
38+
{ "id": "test1.msg1.6", "defaultMessage": "This is message 1.6" },
39+
{
40+
"id": "test1.msg1.7",
41+
"defaultMessage": "This is message 1.7",
42+
"description": "Description for message 1.7"
43+
},
44+
{ "id": "test1.msg2.1", "defaultMessage": "This is message 2.1" },
45+
{
46+
"id": "test1.msg2.2",
47+
"defaultMessage": "This is message 2.2",
48+
"description": "Description for message 2.2"
49+
},
50+
{ "id": "test2.msg1.1", "defaultMessage": "This is message 2.1.1" }
51+
]
52+
|};
53+
54+
let testExtractFull = () => checkRes("test/test1 test/test2", (full, ""));
55+
56+
let partial = {|[
57+
{ "id": "test1.msg2.1", "defaultMessage": "This is message 2.1" },
58+
{
59+
"id": "test1.msg2.2",
60+
"defaultMessage": "This is message 2.2",
61+
"description": "Description for message 2.2"
62+
},
63+
{ "id": "test2.msg1.1", "defaultMessage": "This is message 2.1.1" }
64+
]
65+
|};
66+
67+
let testExtractPartial = () => checkRes("test/test1/subdir/Test_1_2.re test/test2", (partial, ""));
68+
69+
let testSet = [("Extract full", `Quick, testExtractFull), ("Extract partial", `Quick, testExtractPartial)];
70+
};
71+
72+
let () =
73+
Alcotest.run(
74+
"bs-react-intl-extractor",
75+
[("usage", Usage.testSet), ("version", Version.testSet), ("extraact", Extract.testSet)],
76+
);

test/dune

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(ignored_subdirs (test1 test2))
2+
3+
(executable
4+
(name Test)
5+
(public_name TestBsReactIntlExtractor.exe)
6+
(libraries alcotest)
7+
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/commandLineOptions.test.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)