Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests. #169

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion analysis/src/Commands.ml
Original file line number Diff line number Diff line change
@@ -172,7 +172,8 @@ let documentSymbol ~path =
| Module (Structure contents) -> (Module, getItems contents)
| Module (Ident _) -> (Module, [])
in
(txt, extentLoc, item) :: siblings
if extentLoc.loc_ghost then siblings
else (txt, extentLoc, item) :: siblings
in
let x = topLevel |> List.map fn |> List.concat in
x
2 changes: 1 addition & 1 deletion analysis/test.sh
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ function exp {
echo "$(dirname $1)/expected/$(basename $1).txt"
}

for file in tests/src/*.res[i]; do
for file in tests/src/*.res*; do
./rescript-editor-analysis.exe test $file &> $(exp $file)
done

14 changes: 7 additions & 7 deletions analysis/tests/src/expected/Complete.res.txt
Original file line number Diff line number Diff line change
@@ -4,19 +4,19 @@ Complete tests/src/Complete.res 0:2
"kind": 12,
"tags": [],
"detail": "(t<'a>, 'a => 'b) => t<'b>",
"documentation": {"kind": "markdown", "value": " [mapReverse xs f]\n\n Equivalent to [reverse (map xs f)]\n\n @example {[\n mapReverse [3;4;5] (fun x -> x * x) = [25;16;9];;\n ]}\n"}
"documentation": {"kind": "markdown", "value": " [mapReverse xs f]\n\n Equivalent to [reverse (map xs f)]\n \n @example {[\n mapReverse [3;4;5] (fun x -> x * x) = [25;16;9];;\n ]}\n"}
}, {
"label": "makeBy",
"kind": 12,
"tags": [],
"detail": "(int, int => 'a) => t<'a>",
"documentation": {"kind": "markdown", "value": " [makeBy n f] \n\n - return a list of length [n] with element [i] initialized with [f i]\n - return the empty list if [n] is negative\n\n @example {[\n makeBy 5 (fun i -> i) = [0;1;2;3;4];;\n makeBy 5 (fun i -> i * i) = [0;1;4;9;16];;\n ]}\n"}
"documentation": {"kind": "markdown", "value": " [makeBy n f] \n \n - return a list of length [n] with element [i] initialized with [f i]\n - return the empty list if [n] is negative\n\n @example {[\n makeBy 5 (fun i -> i) = [0;1;2;3;4];;\n makeBy 5 (fun i -> i * i) = [0;1;4;9;16];;\n ]}\n"}
}, {
"label": "make",
"kind": 12,
"tags": [],
"detail": "(int, 'a) => t<'a>",
"documentation": {"kind": "markdown", "value": " [make n v] \n\n - return a list of length [n] with each element filled with value [v] \n - return the empty list if [n] is negative\n\n @example {[\n make 3 1 = [1;1;1]\n ]}\n"}
"documentation": {"kind": "markdown", "value": " [make n v] \n \n - return a list of length [n] with each element filled with value [v] \n - return the empty list if [n] is negative\n\n @example {[\n make 3 1 = [1;1;1]\n ]}\n"}
}, {
"label": "mapReverse2U",
"kind": 12,
@@ -58,7 +58,7 @@ Complete tests/src/Complete.res 0:2
"kind": 12,
"tags": [],
"detail": "(t<'a>, (int, 'a) => 'b) => t<'b>",
"documentation": {"kind": "markdown", "value": " [mapWithIndex xs f] applies [f] to each element of [xs]. Function [f] takes two arguments:\n the index starting from 0 and the element from [xs].\n\n @example {[\n mapWithIndex [1;2;3] (fun i x -> i + x) =\n [0 + 1; 1 + 2; 2 + 3 ]\n ]}\n"}
"documentation": {"kind": "markdown", "value": " [mapWithIndex xs f] applies [f] to each element of [xs]. Function [f] takes two arguments:\n the index starting from 0 and the element from [xs].\n\n @example {[\n mapWithIndex [1;2;3] (fun i x -> i + x) =\n [0 + 1; 1 + 2; 2 + 3 ]\n ]}\n"}
}, {
"label": "mapReverseU",
"kind": 12,
@@ -391,13 +391,13 @@ Complete tests/src/Complete.res 27:2
"kind": 12,
"tags": [],
"detail": "(option<'a>, option<'b>, (. 'a, 'b) => bool) => bool",
"documentation": {"kind": "markdown", "value": "\n Uncurried version of [eq]\n"}
"documentation": {"kind": "markdown", "value": "\n Uncurried version of [eq]\n"}
}, {
"label": "Belt.Option.eq",
"kind": 12,
"tags": [],
"detail": "(option<'a>, option<'b>, ('a, 'b) => bool) => bool",
"documentation": {"kind": "markdown", "value": "\n [eq optValue1 optvalue2 predicate]\n\n Evaluates two optional values for equality with respect to a predicate function.\n\n If both [optValue1] and [optValue2] are [None], returns [true].\n\n If one of the arguments is [Some value] and the other is [None], returns [false]\n\n If arguments are [Some value1] and [Some value2], returns the result of [predicate value1 value2];\n the [predicate] function must return a [bool]\n\n @example {[\n let clockEqual = (fun a b -> a mod 12 = b mod 12);;\n eq (Some 3) (Some 15) clockEqual = true;;\n eq (Some 3) None clockEqual = false;;\n eq None (Some 3) clockEqual = false;;\n eq None None clockEqual = true;;\n ]}\n"}
"documentation": {"kind": "markdown", "value": "\n [eq optValue1 optvalue2 predicate]\n \n Evaluates two optional values for equality with respect to a predicate function.\n \n If both [optValue1] and [optValue2] are [None], returns [true].\n \n If one of the arguments is [Some value] and the other is [None], returns [false]\n \n If arguments are [Some value1] and [Some value2], returns the result of [predicate value1 value2];\n the [predicate] function must return a [bool]\n \n @example {[\n let clockEqual = (fun a b -> a mod 12 = b mod 12);;\n eq (Some 3) (Some 15) clockEqual = true;;\n eq (Some 3) None clockEqual = false;;\n eq None (Some 3) clockEqual = false;;\n eq None None clockEqual = true;;\n ]}\n"}
}]

Complete tests/src/Complete.res 36:2
@@ -421,7 +421,7 @@ Complete tests/src/Complete.res 38:2
"kind": 12,
"tags": [],
"detail": "(t<'a>, key) => 'a",
"documentation": {"kind": "markdown", "value": " [unsafeGet dict key] return the value if the [key] exists, \n otherwise an {b undefined} value is returned. Must be used only \n when the existence of a key is certain. (i.e. when having called [keys]\n function previously. \n\n @example {[\n Array.iter (fun key -> Js.log (Js_dict.unsafeGet dic key)) (Js_dict.keys dict) \n ]} \n"}
"documentation": {"kind": "markdown", "value": " [unsafeGet dict key] return the value if the [key] exists, \n otherwise an {b undefined} value is returned. Must be used only \n when the existence of a key is certain. (i.e. when having called [keys]\n function previously. \n\n@example {[\nArray.iter (fun key -> Js.log (Js_dict.unsafeGet dic key)) (Js_dict.keys dict) \n]} \n"}
}, {
"label": "unsafeDeleteKey",
"kind": 12,