Skip to content

Commit 233c664

Browse files
committed
add tests
1 parent e34238c commit 233c664

33 files changed

+910
-125
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ analysis/tests/.merlin
99

1010
tools/node_modules
1111
tools/lib
12-
tools/**/*.bs.js
12+
tools/**/*.res.js
13+
tools/tests/node_modules
14+
tools/tests/lib
1315

1416
rescript-editor-analysis.exe
1517
rescript-tools.exe

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ build:
77

88
test:
99
make -C analysis test
10+
make -C tools test
1011

1112
clean:
1213
dune clean
1314
make -C analysis clean
15+
make -C tools clean
1416

1517
format:
1618
dune build @fmt --auto-promote

analysis.opam

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ homepage: "https://github.com/rescript-lang/rescript-vscode"
77
bug-reports: "https://github.com/rescript-lang/rescript-vscode/issues"
88
depends: [
99
"ocaml" {>= "4.10"}
10-
"ocamlformat" {= "0.26.1"}
1110
"cppo" {= "1.6.9"}
1211
"dune"
1312
]

analysis/bin/main.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,6 @@ let main () =
145145
~pos:(int_of_string line_start, int_of_string line_end)
146146
~maxLength ~debug
147147
| [_; "codeLens"; path] -> Commands.codeLens ~path ~debug
148-
| [_; "extractDocs"; path] ->
149-
let () =
150-
match Sys.getenv_opt "FROM_COMPILER" with
151-
| Some "true" -> Cfg.isDocGenFromCompiler := true
152-
| _ -> ()
153-
in
154-
155-
DocExtraction.extractDocs ~path ~debug
156148
| [_; "codeAction"; path; startLine; startCol; endLine; endCol; currentFile]
157149
->
158150
Commands.codeAction ~path

analysis/src/Commands.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,6 @@ let test ~path =
347347
let currentFile = createCurrentFile () in
348348
signatureHelp ~path ~pos:(line, col) ~currentFile ~debug:true;
349349
Sys.remove currentFile
350-
| "dex" ->
351-
print_endline ("Documentation extraction " ^ path);
352-
DocExtraction.extractDocs ~path ~debug:true
353350
| "int" ->
354351
print_endline ("Create Interface " ^ path);
355352
let cmiFile =

dune-project

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
(depends
1717
(ocaml
1818
(>= 4.10))
19-
(ocamlformat
20-
(= 0.26.1))
2119
(cppo
2220
(= 1.6.9))
2321
dune))

tools/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SHELL = /bin/bash
2+
3+
node_modules/.bin/rescript:
4+
npm install
5+
6+
build: node_modules/.bin/rescript
7+
node_modules/.bin/rescript
8+
9+
test: build
10+
cd tests && ./test.sh
11+
12+
clean:
13+
rm -r node_modules lib
14+
15+
.DEFAULT_GOAL := test
16+
17+
.PHONY: clean test

tools/bin/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
(modes byte exe)
55
; The main module that will become the binary.
66
(name main)
7-
(libraries analysis)
7+
(libraries tools)
88
(flags
99
(-w "+6+26+27+32+33+39")))

tools/bin/main.ml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ let main () =
3838
| "doc" :: rest -> (
3939
match rest with
4040
| ["-h"] | ["--help"] -> logAndExit ~log:docHelp ~code:`Ok
41-
| [path] -> (
41+
| [path] ->
4242
(* NOTE: Internal use to generate docs from compiler *)
43-
let () = match Sys.getenv_opt "FROM_COMPILER" with
44-
| Some("true") -> Analysis.Cfg.isDocGenFromCompiler := true
45-
| _ -> () in
46-
Analysis.DocExtraction.extractDocs ~path ~debug:false
47-
)
43+
let () =
44+
match Sys.getenv_opt "FROM_COMPILER" with
45+
| Some "true" -> Analysis.Cfg.isDocGenFromCompiler := true
46+
| _ -> ()
47+
in
48+
Tools.extractDocs ~path ~debug:false
4849
| _ -> logAndExit ~log:docHelp ~code:`Error)
4950
| "reanalyze" :: _ ->
5051
let len = Array.length Sys.argv in

tools/dune

Lines changed: 0 additions & 1 deletion
This file was deleted.

tools/npm/RescriptTools.bs.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

0 commit comments

Comments
 (0)