Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
3Rafal committed Jan 5, 2024
1 parent 3a4aee2 commit 0806987
Showing 1 changed file with 152 additions and 2 deletions.
154 changes: 152 additions & 2 deletions tests/test-dirs/signature-help.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
It can provide signature help after a function-type value
It can provide signature help after a function-type value.

$ $MERLIN single signature-help -position 2:11 -filename=sig_help.ml <<EOF
$ $MERLIN single signature-help -position 2:11 <<EOF
> let map = ListLabels.map
> let _ = map
> EOF
Expand All @@ -23,3 +23,153 @@ It can provide signature help after a function-type value
},
"notifications": []
}

It can provide signature help for an operator.

$ $MERLIN single signature-help -position 2:13 <<EOF
> let (+) = (+)
> let _ = 1 + 2
> EOF
{
"class": "return",
"value": {
"function_name": "(+)",
"signature": "int -> int -> int",
"parameters": [
{
"label_start": 6,
"label_end": 9
},
{
"label_start": 13,
"label_end": 16
}
],
"active_param": 1
},
"notifications": []
}

It can provide signature help for an anonymous function.

$ $MERLIN single signature-help -position 1:26 <<EOF
> let _ = (fun x -> x + 1)
> EOF
{
"class": "return",
"value": {
"function_name": "_",
"signature": "int -> int",
"parameters": [
{
"label_start": 4,
"label_end": 7
}
],
"active_param": 0
},
"notifications": []
}

It can make the non-labelled parameter active.

$ $MERLIN single signature-help -position 2:14 <<EOF
> let map = ListLabels.map
> let _ = map []
> EOF
{
"class": "return",
"value": {
"function_name": "map",
"signature": "f:('a -> 'b) -> 'a list -> 'b list",
"parameters": [
{
"label_start": 6,
"label_end": 18
},
{
"label_start": 22,
"label_end": 29
}
],
"active_param": 1
},
"notifications": []
}

It can make the labelled parameter active.
$ $MERLIN single signature-help -position 2:14 <<EOF
> let map = ListLabels.map
> let _ = map ~f:Int.abs
> EOF
{
"class": "return",
"value": {
"function_name": "map",
"signature": "f:(int -> int) -> int list -> int list",
"parameters": [
{
"label_start": 6,
"label_end": 20
},
{
"label_start": 24,
"label_end": 32
}
],
"active_param": 0
},
"notifications": []
}

It can make a labelled parameter active by prefix.

$ $MERLIN single signature-help -position 2:15 <<EOF
> let mem = ListLabels.mem
> let _ = mem ~se
> EOF
{
"class": "return",
"value": {
"function_name": "mem",
"signature": "'a -> set:'a list -> bool",
"parameters": [
{
"label_start": 6,
"label_end": 8
},
{
"label_start": 12,
"label_end": 23
}
],
"active_param": 1
},
"notifications": []
}

It can make an optional parameter active by prefix.

$ $MERLIN single signature-help -position 2:18 <<EOF
> let create = Hashtbl.create
> let _ = create ?ra
> EOF
{
"class": "return",
"value": {
"function_name": "create",
"signature": "?random:bool -> int -> ('a, 'b) Hashtbl.t",
"parameters": [
{
"label_start": 9,
"label_end": 21
},
{
"label_start": 25,
"label_end": 28
}
],
"active_param": 0
},
"notifications": []
}

0 comments on commit 0806987

Please sign in to comment.