Skip to content

Commit

Permalink
Update test with more branches
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Jul 27, 2023
1 parent 5f42660 commit 68f61b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 326 deletions.
16 changes: 8 additions & 8 deletions tests/test-dirs/type-enclosing/letop.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ Various parts of the letop:
"col": 2
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 6
},
"type": "('a -> 'b) -> 'a option -> 'b option",
"type": "'a -> 'b -> ('c -> 'd) -> 'c option -> 'd option",
"tail": "no"
},
{
"start": {
"line": 3,
"col": 17
"line": 4,
"col": 2
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 6
},
"type": "'a -> ('b -> 'c) -> 'b option -> 'c option",
"type": "'a option -> (int -> int) -> ('b -> 'c) -> 'b option -> 'c option",
"tail": "no"
}
]
Expand Down
5 changes: 3 additions & 2 deletions tests/test-dirs/type-enclosing/letop2.t/letop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ let (and+) x y =

let minus_three (tbl1, tbl2) (key1, key2) =
let+ foo = Hashtbl.find_opt tbl1 key1
and+ bar = Hashtbl.find_opt tbl2 key2 in
foo + bar - 3
and+ bar = Hashtbl.find_opt tbl2 key2
and+ man = Hashtbl.find_opt tbl2 key2 in
foo + bar - man
320 changes: 4 additions & 316 deletions tests/test-dirs/type-enclosing/letop2.t/run.t
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Various parts of the letop together with andop:

- The first let+ operator:

TODO: Type is wrong here, shouldn't be int * int

- The let+ operator:
$ $MERLIN single type-enclosing -position 8:4 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
Expand All @@ -16,328 +13,19 @@ TODO: Type is wrong here, shouldn't be int * int
"line": 8,
"col": 6
},
"type": "int * int",
"tail": "no"
},
{
"start": {
"line": 8,
"col": 2
},
"end": {
"line": 10,
"col": 15
},
"type": "int option",
"tail": "no"
}
]

- The pattern:

TODO: type is wrong; range is wrong

$ $MERLIN single type-enclosing -position 8:9 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 2
},
"end": {
"line": 10,
"col": 15
},
"type": "int option",
"tail": "no"
},
{
"start": {
"line": 7,
"col": 29
},
"end": {
"line": 10,
"col": 15
},
"type": "'a * 'b -> int option",
"tail": "no"
}
]

- The rhs:

$ $MERLIN single type-enclosing -position 8:22 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 13
},
"end": {
"line": 8,
"col": 29
},
"type": "('a, 'b) Hashtbl.t -> 'a -> 'b option",
"tail": "no"
},
{
"start": {
"line": 8,
"col": 13
},
"end": {
"line": 8,
"col": 29
},
"type": "('a, int) Hashtbl.t -> 'a -> int option",
"tail": "no"
}
]

$ $MERLIN single type-enclosing -position 8:31 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 30
},
"end": {
"line": 8,
"col": 34
},
"type": "('a, int) Hashtbl.t",
"tail": "no"
},
{
"start": {
"line": 8,
"col": 13
},
"end": {
"line": 8,
"col": 39
},
"type": "int option",
"tail": "no"
}
]

$ $MERLIN single type-enclosing -position 8:36 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 35
},
"end": {
"line": 8,
"col": 39
},
"type": "'a",
"tail": "no"
},
{
"start": {
"line": 8,
"col": 13
},
"end": {
"line": 8,
"col": 39
},
"type": "int option",
"tail": "no"
}
]

- The second and+ operator:

TODO: type is wrong; range is wrong

$ $MERLIN single type-enclosing -position 9:4 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 2
},
"end": {
"line": 10,
"col": 15
},
"type": "int option",
"type": "'a option -> ('a -> 'b) -> 'b option",
"tail": "no"
},
{
"start": {
"line": 7,
"col": 29
},
"end": {
"line": 10,
"col": 15
},
"type": "'a * 'b -> int option",
"tail": "no"
}
]

- The pattern:

TODO: type is wrong; range is wrong

$ $MERLIN single type-enclosing -position 9:9 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 2
},
"end": {
"line": 10,
"col": 15
},
"type": "int option",
"tail": "no"
},
{
"start": {
"line": 7,
"col": 29
},
"end": {
"line": 10,
"col": 15
},
"type": "'a * 'b -> int option",
"tail": "no"
}
]

- The rhs:

$ $MERLIN single type-enclosing -position 9:22 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 9,
"col": 13
},
"end": {
"line": 9,
"col": 29
},
"type": "('a, 'b) Hashtbl.t -> 'a -> 'b option",
"tail": "no"
},
{
"start": {
"line": 9,
"col": 13
},
"end": {
"line": 9,
"col": 29
},
"type": "('a, int) Hashtbl.t -> 'a -> int option",
"tail": "no"
}
]

$ $MERLIN single type-enclosing -position 8:31 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 30
},
"end": {
"line": 8,
"col": 34
},
"type": "('a, int) Hashtbl.t",
"tail": "no"
},
{
"start": {
"line": 8,
"col": 13
},
"end": {
"line": 8,
"col": 39
},
"type": "int option",
"tail": "no"
}
]

$ $MERLIN single type-enclosing -position 8:36 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 35
},
"end": {
"line": 8,
"col": 39
},
"type": "'a",
"tail": "no"
},
{
"start": {
"line": 8,
"col": 13
},
"end": {
"line": 8,
"col": 39
},
"type": "int option",
"tail": "no"
}
]

- After the in:

$ $MERLIN single type-enclosing -position 9:42 -verbosity 0 \
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]"
[
{
"start": {
"line": 8,
"col": 2
},
"end": {
"line": 10,
"col": 15
},
"type": "int option",
"tail": "no"
},
{
"start": {
"line": 7,
"col": 29
},
"end": {
"line": 10,
"col": 15
"col": 6
},
"type": "'a * 'b -> int option",
"type": "((int * int) * int) option -> ((int * int) * int -> int) -> int option",
"tail": "no"
}
]

0 comments on commit 68f61b7

Please sign in to comment.