Skip to content
This repository has been archived by the owner on Apr 24, 2021. It is now read-only.

Check in results of tests. #130

Merged
merged 7 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(dirs :standard \ examples)
(dirs :standard \ examples test)
(env
(dev
(flags (:standard -warn-error -A))))
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "rescript-editor-support",
"version": "1.0.0",
"scripts": {
"test": "cd test && ./test.sh",
"dce": "dune build @check @all && node_modules/.bin/reanalyze -dce-cmt _build -suppress src/vendor"
},
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/EditorSupportCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ let test ~path =
if mlen >= 3 then
match String.sub rest 0 3 with
| "def" -> definition ~path ~line ~col
| "hov" -> hover ~path ~line ~col
| "com" ->
let currentFile, cout = Filename.open_temp_file "def" "txt" in
lines
Expand Down
5 changes: 0 additions & 5 deletions test.sh

This file was deleted.

5 changes: 3 additions & 2 deletions test/bsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "test",
"sources": "src",
"bs-dependencies": ["reason-react"]
}
"bs-dependencies": ["reason-react"],
"reason": { "react-jsx": 3 }
}
29 changes: 1 addition & 28 deletions test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/src/Hover.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let abc = 22 + 34
// ^hov
12 changes: 12 additions & 0 deletions test/src/Jsx.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module M = {
@react.component
let make = (~first, ~fun="", ~second="") => React.string(first ++ fun++ second)
}

let d = <M first="abc" />
// ^def

//^com <M second=fi


//^com <M second="abc" f
1 change: 0 additions & 1 deletion test/expected.txt → test/src/expected/Complete.res.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{"uri": "Definition.res", "range": "{"start": "{"line": "0", "character": "4"}", "end": "{"line": "0", "character": "6"}"}"}
[{
"label": "mapReverse",
"kind": 12,
Expand Down
1 change: 1 addition & 0 deletions test/src/expected/Definition.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"uri": "Definition.res", "range": "{"start": "{"line": "0", "character": "4"}", "end": "{"line": "0", "character": "6"}"}"}
1 change: 1 addition & 0 deletions test/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"contents": "```rescript\nint\n```"}
21 changes: 21 additions & 0 deletions test/src/expected/Jsx.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{"uri": "Jsx.res", "range": "{"start": "{"line": "2", "character": "6"}", "end": "{"line": "2", "character": "10"}"}"}
[]
[{
"label": "key",
"kind": 4,
"tags": [],
"detail": "string",
"documentation": {"kind": "markdown", "value": "\nJsx.res:11"}
}, {
"label": "first",
"kind": 4,
"tags": [],
"detail": "string",
"documentation": {"kind": "markdown", "value": "\nJsx.res:11"}
}, {
"label": "fun",
"kind": 4,
"tags": [],
"detail": "option<string>",
"documentation": {"kind": "markdown", "value": "\nJsx.res:11"}
}]
10 changes: 10 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/zsh

function exp {
echo "$(dirname $1)/expected/$(basename $1).txt"
}

./node_modules/.bin/rescript build
for file in src/**/*.res; do
../_build/install/default/bin/rescript-editor-support.exe test $file &> $(exp $file)
done