forked from ocaml/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
225 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
FIXME: No result is returned, we could expect the one occurrence of None. | ||
No result is returned, we could expect the one occurrence of None. | ||
$ $MERLIN single occurrences -identifier-at 3:3 -filename opt.ml <<EOF | \ | ||
> jq '.value' | ||
> (* test case *) | ||
> let f ?(x=1) () = 2 ;; | ||
> None | ||
> EOF | ||
[] | ||
[ | ||
{ | ||
"start": { | ||
"line": 3, | ||
"col": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 4 | ||
} | ||
} | ||
] | ||
|
||
$ $MERLIN single occurrences -identifier-at 3:3 -filename opt.ml <<EOF | \ | ||
> jq '.value' | ||
> (* test case *) | ||
> let f () = 2 ;; | ||
> None | ||
> EOF | ||
[] | ||
[ | ||
{ | ||
"start": { | ||
"line": 3, | ||
"col": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 4 | ||
} | ||
} | ||
] |
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,54 @@ | ||
$ cat >oui_ml.ml <<'EOF' | ||
> type t = int | ||
> EOF | ||
|
||
$ cat >no_ml.mli <<'EOF' | ||
> include module type of Oui_ml | ||
> EOF | ||
|
||
$ cat >main.ml <<'EOF' | ||
> let (x : No_ml.t) = 42 | ||
> open No_ml | ||
> let (y : t) = 43 | ||
> EOF | ||
|
||
$ $OCAMLC -bin-annot -c oui_ml.ml no_ml.mli | ||
|
||
$ $MERLIN single occurrences -scope project -identifier-at 1:15 \ | ||
> -filename main.ml <main.ml | jq '.value' | ||
[ | ||
{ | ||
"file": "$TESTCASE_ROOT/main.ml", | ||
"start": { | ||
"line": 1, | ||
"col": 15 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 16 | ||
} | ||
}, | ||
{ | ||
"file": "$TESTCASE_ROOT/main.ml", | ||
"start": { | ||
"line": 3, | ||
"col": 9 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 10 | ||
} | ||
} | ||
] | ||
|
||
|
||
|
||
$ $MERLIN single locate -look-for ml -position 1:15 \ | ||
> -filename main.ml <main.ml | jq '.value' | ||
{ | ||
"file": "$TESTCASE_ROOT/oui_ml.ml", | ||
"pos": { | ||
"line": 1, | ||
"col": 5 | ||
} | ||
} |
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,146 @@ | ||
Some occurrences are only available locally an dnot part of the global index | ||
|
||
$ cat >local.ml <<'EOF' | ||
> type t = int | ||
> let x : int = 42 | ||
> EOF | ||
|
||
Predef: | ||
$ $MERLIN single occurrences -identifier-at 2:9 \ | ||
> -filename local.ml <local.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 1, | ||
"col": 9 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 12 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 8 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 11 | ||
} | ||
} | ||
] | ||
|
||
|
||
Predef constructors: | ||
$ cat >local.ml <<'EOF' | ||
> let _ = None | ||
> let None = None | ||
> EOF | ||
|
||
$ $MERLIN single occurrences -identifier-at 1:10 \ | ||
> -filename local.ml <local.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 1, | ||
"col": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 12 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 4 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 8 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 11 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 15 | ||
} | ||
} | ||
] | ||
|
||
true / false | ||
$ cat >local.ml <<'EOF' | ||
> let _ = true | ||
> let _ = true | ||
> EOF | ||
|
||
$ $MERLIN single occurrences -identifier-at 1:10 \ | ||
> -filename local.ml <local.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 1, | ||
"col": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 12 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 8 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 12 | ||
} | ||
} | ||
] | ||
|
||
unit | ||
$ cat >local.ml <<'EOF' | ||
> let _ = () | ||
> let f () = () | ||
> EOF | ||
|
||
$ $MERLIN single occurrences -identifier-at 1:9 \ | ||
> -filename local.ml <local.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 1, | ||
"col": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 10 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 6 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 8 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 11 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 13 | ||
} | ||
} | ||
] |