Skip to content

Commit a4103bd

Browse files
committed
update test
1 parent 1810a67 commit a4103bd

File tree

1 file changed

+32
-32
lines changed
  • plugins/hls-explicit-record-fields-plugin/test

1 file changed

+32
-32
lines changed

plugins/hls-explicit-record-fields-plugin/test/Main.hs

+32-32
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ test = testGroup "explicit-fields"
3838
]
3939
, testGroup "inlay hints"
4040
[ mkInlayHintsTest "Construction" 16 $ \ih -> do
41-
let mkLabelPart' = mkLabelPart "Construction" 16 12
42-
foo <- mkLabelPart' "foo"
43-
bar <- mkLabelPart' "bar"
44-
baz <- mkLabelPart' "baz"
41+
let mkLabelPart' = mkLabelPart "Construction"
42+
foo <- mkLabelPart' 13 6 "foo"
43+
bar <- mkLabelPart' 14 6 "bar"
44+
baz <- mkLabelPart' 15 6 "baz"
4545
(@?=) ih
4646
[defInlayHint { _position = Position 16 14
4747
, _label = InR [ foo, commaPart
@@ -55,8 +55,8 @@ test = testGroup "explicit-fields"
5555
, _paddingLeft = Just True
5656
}]
5757
, mkInlayHintsTest "HsExpanded1" 17 $ \ih -> do
58-
let mkLabelPart' = mkLabelPart "HsExpanded1" 17 17
59-
foo <- mkLabelPart' "foo"
58+
let mkLabelPart' = mkLabelPart "HsExpanded1"
59+
foo <- mkLabelPart' 11 4 "foo"
6060
(@?=) ih
6161
[defInlayHint { _position = Position 17 19
6262
, _label = InR [ foo ]
@@ -65,8 +65,8 @@ test = testGroup "explicit-fields"
6565
, _paddingLeft = Just True
6666
}]
6767
, mkInlayHintsTest "HsExpanded2" 23 $ \ih -> do
68-
let mkLabelPart' = mkLabelPart "HsExpanded2" 23 19
69-
bar <- mkLabelPart' "bar"
68+
let mkLabelPart' = mkLabelPart "HsExpanded2"
69+
bar <- mkLabelPart' 14 4 "bar"
7070
(@?=) ih
7171
[defInlayHint { _position = Position 23 21
7272
, _label = InR [ bar ]
@@ -75,9 +75,9 @@ test = testGroup "explicit-fields"
7575
, _paddingLeft = Just True
7676
}]
7777
, mkInlayHintsTest "Mixed" 14 $ \ih -> do
78-
let mkLabelPart' = mkLabelPart "Mixed" 14 34
79-
baz <- mkLabelPart' "baz"
80-
quux <- mkLabelPart' "quux"
78+
let mkLabelPart' = mkLabelPart "Mixed"
79+
baz <- mkLabelPart' 9 4 "baz"
80+
quux <- mkLabelPart' 10 4 "quux"
8181
(@?=) ih
8282
[defInlayHint { _position = Position 14 36
8383
, _label = InR [ baz, commaPart
@@ -88,10 +88,10 @@ test = testGroup "explicit-fields"
8888
, _paddingLeft = Just True
8989
}]
9090
, mkInlayHintsTest "Unused" 12 $ \ih -> do
91-
let mkLabelPart' = mkLabelPart "Unused" 12 17
92-
foo <- mkLabelPart' "foo"
93-
bar <- mkLabelPart' "bar"
94-
baz <- mkLabelPart' "baz"
91+
let mkLabelPart' = mkLabelPart "Unused"
92+
foo <- mkLabelPart' 6 4 "foo"
93+
bar <- mkLabelPart' 7 4 "bar"
94+
baz <- mkLabelPart' 8 4 "baz"
9595
(@?=) ih
9696
[defInlayHint { _position = Position 12 19
9797
, _label = InR [ foo, commaPart
@@ -105,10 +105,10 @@ test = testGroup "explicit-fields"
105105
, _paddingLeft = Just True
106106
}]
107107
, mkInlayHintsTest "Unused2" 12 $ \ih -> do
108-
let mkLabelPart' = mkLabelPart "Unused2" 12 17
109-
foo <- mkLabelPart' "foo"
110-
bar <- mkLabelPart' "bar"
111-
baz <- mkLabelPart' "baz"
108+
let mkLabelPart' = mkLabelPart "Unused2"
109+
foo <- mkLabelPart' 6 4 "foo"
110+
bar <- mkLabelPart' 7 4 "bar"
111+
baz <- mkLabelPart' 8 4 "baz"
112112
(@?=) ih
113113
[defInlayHint { _position = Position 12 19
114114
, _label = InR [ foo, commaPart
@@ -122,10 +122,10 @@ test = testGroup "explicit-fields"
122122
, _paddingLeft = Just True
123123
}]
124124
, mkInlayHintsTest "WildcardOnly" 12 $ \ih -> do
125-
let mkLabelPart' = mkLabelPart "WildcardOnly" 12 17
126-
foo <- mkLabelPart' "foo"
127-
bar <- mkLabelPart' "bar"
128-
baz <- mkLabelPart' "baz"
125+
let mkLabelPart' = mkLabelPart "WildcardOnly"
126+
foo <- mkLabelPart' 6 4 "foo"
127+
bar <- mkLabelPart' 7 4 "bar"
128+
baz <- mkLabelPart' 8 4 "baz"
129129
(@?=) ih
130130
[defInlayHint { _position = Position 12 19
131131
, _label = InR [ foo, commaPart
@@ -139,9 +139,9 @@ test = testGroup "explicit-fields"
139139
, _paddingLeft = Just True
140140
}]
141141
, mkInlayHintsTest "WithExplicitBind" 12 $ \ih -> do
142-
let mkLabelPart' = mkLabelPart "WithExplicitBind" 12 29
143-
bar <- mkLabelPart' "bar"
144-
baz <- mkLabelPart' "baz"
142+
let mkLabelPart' = mkLabelPart "WithExplicitBind"
143+
bar <- mkLabelPart' 7 4 "bar"
144+
baz <- mkLabelPart' 8 4 "baz"
145145
(@?=) ih
146146
[defInlayHint { _position = Position 12 31
147147
, _label = InR [ bar, commaPart
@@ -154,9 +154,9 @@ test = testGroup "explicit-fields"
154154
, _paddingLeft = Just True
155155
}]
156156
, mkInlayHintsTest "WithPun" 13 $ \ih -> do
157-
let mkLabelPart' = mkLabelPart "WithPun" 13 22
158-
bar <- mkLabelPart' "bar"
159-
baz <- mkLabelPart' "baz"
157+
let mkLabelPart' = mkLabelPart "WithPun"
158+
bar <- mkLabelPart' 8 4 "bar"
159+
baz <- mkLabelPart' 9 4 "baz"
160160
(@?=) ih
161161
[defInlayHint { _position = Position 13 24
162162
, _label = InR [ bar, commaPart
@@ -227,17 +227,17 @@ defInlayHint =
227227
}
228228

229229
mkLabelPart :: FilePath -> UInt -> UInt -> Text -> IO InlayHintLabelPart
230-
mkLabelPart fp dotline dotstart value = do
230+
mkLabelPart fp line start value = do
231231
uri' <- uri
232-
pure $ InlayHintLabelPart { _location = Just (location uri' dotline dotstart)
232+
pure $ InlayHintLabelPart { _location = Just (location uri' line start)
233233
, _value = value
234234
, _tooltip = Nothing
235235
, _command = Nothing
236236
}
237237
where
238238
toUri = fromNormalizedUri . filePathToUri' . toNormalizedFilePath'
239239
uri = canonicalizeUri $ toUri (testDataDir </> (fp ++ ".hs"))
240-
location uri line char = Location uri (Range (Position line char) (Position line (char + 2)))
240+
location uri line char = Location uri (Range (Position line char) (Position line (char + (fromIntegral $ T.length value))))
241241

242242
commaPart :: InlayHintLabelPart
243243
commaPart =

0 commit comments

Comments
 (0)