-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix EXCLUDE_QUERY_DIR for cms/cmt files (#104)
* Fix EXCLUDE_QUERY_DIR for cms/cmt files * Modify test to use cmt and cms files * Incorporate PR feedback * Stop running test on windows * Refactor to share functionality between build_path and cmt_path
- Loading branch information
Showing
3 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Test the EXCLUDE_QUERY_DIR directive, which tells Merlin not to look for build artifacts | ||
in the directory of the file being queried on. To test, we create a/test.ml, which depends | ||
on b/foo.ml. The folder b contains a .cmt for the Foo module, and Merlin is configured to | ||
look there. We also include a malformatted foo.cmt in the query directory. | ||
$ mkdir a | ||
$ mkdir b | ||
|
||
$ cat > a/test.ml << EOF | ||
> let x = Foo.bar | ||
> EOF | ||
|
||
$ cat > b/foo.ml << EOF | ||
> let bar = 10 | ||
> EOF | ||
|
||
Create the proper and malformatted .cmt files | ||
$ $OCAMLC -c -bin-annot b/foo.ml | ||
$ touch a/foo.cmt | ||
|
||
Configure Merlin | ||
$ cat > a/.merlin << EOF | ||
> S . | ||
> B ../b | ||
> S ../b | ||
> EXCLUDE_QUERY_DIR | ||
> EOF | ||
|
||
Perform the query | ||
$ $MERLIN single locate -position 1:13 -filename a/test.ml < a/test.ml | ||
{ | ||
"class": "return", | ||
"value": { | ||
"file": "$TESTCASE_ROOT/b/foo.ml", | ||
"pos": { | ||
"line": 1, | ||
"col": 4 | ||
} | ||
}, | ||
"notifications": [] | ||
} | ||
|
||
Jane Street Only: run the same test as above, but with .cms files instead of .cmt | ||
|
||
Remove the old .cmt files | ||
$ rm **/*.cmt | ||
|
||
Create the .cms files | ||
$ $OCAMLC -c -bin-annot-cms b/foo.ml | ||
$ touch a/foo.cms | ||
|
||
Perform the query again | ||
$ $MERLIN single locate -position 1:13 -filename a/test.ml < a/test.ml | ||
{ | ||
"class": "return", | ||
"value": { | ||
"file": "$TESTCASE_ROOT/b/foo.ml", | ||
"pos": { | ||
"line": 1, | ||
"col": 4 | ||
} | ||
}, | ||
"notifications": [] | ||
} |