Skip to content

Commit 5fd2f49

Browse files
committed
Add utf-16 change range test
This tests indexing around characters encoded as two code units in UTF-16.
1 parent f31a74f commit 5fd2f49

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/VspSpec.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,15 @@ vspSpec = do
254254
, "baz ="
255255
, " putStrLn \"hello world\""
256256
]
257+
it "indexes using utf-16 code units" $ do
258+
let
259+
orig = unlines
260+
[ "a𐐀b"
261+
, "a𐐀b"
262+
]
263+
new = applyChange (fromString orig)
264+
$ J.TextDocumentContentChangeEvent (mkRange 1 0 1 3) (Just 3) "𐐀𐐀"
265+
lines (Rope.toString new) `shouldBe`
266+
[ "a𐐀b"
267+
, "𐐀𐐀b"
268+
]

0 commit comments

Comments
 (0)