Skip to content

Commit 8a49e35

Browse files
committed
Add analysis tests
1 parent 3a07374 commit 8a49e35

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

tests/analysis_tests/tests/src/Hover.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,14 @@ type variant = | /** Cool variant! */ CoolVariant | /** Other cool variant */ Ot
254254
let coolVariant = CoolVariant
255255
// ^hov
256256

257+
type payloadVariants = InlineRecord({field1: int, field2: bool}) | Args(int, bool)
258+
259+
let payloadVariant = InlineRecord({field1: 1, field2: true})
260+
// ^hov
261+
262+
let payloadVariant2 = Args(1, true)
263+
// ^hov
264+
257265
// Hover on unsaved
258266
// let fff = "hello"; fff
259267
// ^hov

tests/analysis_tests/tests/src/expected/Hover.res.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,16 @@ Hover src/Hover.res 248:19
303303
Hover src/Hover.res 253:20
304304
{"contents": {"kind": "markdown", "value": "```rescript\nvariant\nCoolVariant\n```\n\n---\n\n```\n \n```\n```rescript\ntype variant = CoolVariant | OtherCoolVariant\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C251%2C0%5D)\n\n---\n Cool variant! "}}
305305

306-
Hover src/Hover.res 257:23
306+
Hover src/Hover.res 258:22
307+
{"contents": {"kind": "markdown", "value": "```rescript\npayloadVariants\nInlineRecord({field1: int, field2: bool})\n```\n\n---\n\n```\n \n```\n```rescript\ntype payloadVariants =\n | InlineRecord({field1: int, field2: bool})\n | Args(int, bool)\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C256%2C0%5D)\n"}}
308+
309+
Hover src/Hover.res 261:23
310+
{"contents": {"kind": "markdown", "value": "```rescript\npayloadVariants\nArgs(int, bool)\n```\n\n---\n\n```\n \n```\n```rescript\ntype payloadVariants =\n | InlineRecord({field1: int, field2: bool})\n | Args(int, bool)\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C256%2C0%5D)\n"}}
311+
312+
Hover src/Hover.res 265:23
307313
Nothing at that position. Now trying to use completion.
308-
posCursor:[257:23] posNoWhite:[257:22] Found expr:[257:22->257:25]
309-
Pexp_ident fff:[257:22->257:25]
314+
posCursor:[265:23] posNoWhite:[265:22] Found expr:[265:22->265:25]
315+
Pexp_ident fff:[265:22->265:25]
310316
Completable: Cpath Value[fff]
311317
Package opens Stdlib.place holder Pervasives.JsxModules.place holder
312318
Resolved opens 1 Stdlib
@@ -317,10 +323,10 @@ Resolved opens 1 Stdlib
317323
ContextPath string
318324
{"contents": {"kind": "markdown", "value": "```rescript\nstring\n```"}}
319325

320-
Hover src/Hover.res 260:33
326+
Hover src/Hover.res 268:33
321327
Nothing at that position. Now trying to use completion.
322-
posCursor:[260:33] posNoWhite:[260:32] Found expr:[260:31->260:40]
323-
Pexp_ident someField:[260:31->260:40]
328+
posCursor:[268:33] posNoWhite:[268:32] Found expr:[268:31->268:40]
329+
Pexp_ident someField:[268:31->268:40]
324330
Completable: Cpath Value[someField]
325331
Package opens Stdlib.place holder Pervasives.JsxModules.place holder
326332
Resolved opens 1 Stdlib
@@ -333,9 +339,9 @@ ContextPath Value[x]
333339
Path x
334340
{"contents": {"kind": "markdown", "value": "```rescript\nbool\n```"}}
335341

336-
Hover src/Hover.res 263:8
342+
Hover src/Hover.res 271:8
337343
{"contents": {"kind": "markdown", "value": "\n [`Belt.Array`]()\n\n **mutable array**: Utilities functions\n\n```rescript\nmodule Array: {\n module Id\n module Array\n module SortArray\n module MutableQueue\n module MutableStack\n module List\n module Range\n module Set\n module Map\n module MutableSet\n module MutableMap\n module HashSet\n module HashMap\n module Option\n module Result\n module Int\n module Float\n}\n```"}}
338344

339-
Hover src/Hover.res 266:6
345+
Hover src/Hover.res 274:6
340346
{"contents": {"kind": "markdown", "value": "```rescript\ntype aliased = variant\n```\n\n---\n\n```\n \n```\n```rescript\ntype variant = CoolVariant | OtherCoolVariant\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C251%2C0%5D)\n"}}
341347

0 commit comments

Comments
 (0)