@@ -24,36 +24,28 @@ spec = do
2424 describe " line col split at" do
2525 let check name t lineCol (before, after) = it name do
2626 let r = Rope. fromText t
27- let (before', after') = Rope. splitAtLineCol lineCol r
28- before' `shouldBe` before
29- after' `shouldBe` after
27+ Rope. splitAtLineCol lineCol r `shouldBe` Just (before, after)
3028 pure @ IO ()
3129
3230 check " index past the line" " abcd\n 1234" (LineCol (Pos 0 ) (Pos 4 )) (" abcd" , " \n 1234" )
3331
3432 it " index on newline" do
3533 let t = " abcd\n 1234"
3634 let r = Rope. fromText t
37- let (before, after) = Rope. splitAtLineCol (LineCol (Pos 0 ) (Pos 5 )) r
38- before `shouldBe` " abcd\n "
39- after `shouldBe` " 1234"
35+ Rope. splitAtLineCol (LineCol (Pos 0 ) (Pos 5 )) r `shouldBe` Just (" abcd\n " , " 1234" )
4036 pure @ IO ()
4137
4238 -- TODO: prevent the rope from doing this
4339 it " index past newline" do
4440 let t = " abcd\n 1234"
4541 let r = Rope. fromText t
46- let (before, after) = Rope. splitAtLineCol (LineCol (Pos 0 ) (Pos 6 )) r
47- before `shouldBe` " abcd\n 1"
48- after `shouldBe` " 234"
42+ Rope. splitAtLineCol (LineCol (Pos 0 ) (Pos 6 )) r `shouldBe` Nothing
4943 pure @ IO ()
5044
5145 it " index past newline" do
5246 let t = " abcd\n 1234\n "
5347 let r = Rope. fromText t
54- let (before, after) = Rope. splitAtLineCol (LineCol (Pos 2 ) (Pos 0 )) r
55- before `shouldBe` " abcd\n 1234\n "
56- after `shouldBe` " "
48+ Rope. splitAtLineCol (LineCol (Pos 2 ) (Pos 0 )) r `shouldBe` Just (" abcd\n 1234\n " , " " )
5749 pure @ IO ()
5850
5951 it " convert line col at the end" do
0 commit comments