1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Verify that sourceSpanToRange computes multi-line ranges.

This commit is contained in:
Rob Rix 2016-09-13 14:27:52 -04:00
parent 8de562b88e
commit 50e5f8a411

View File

@ -25,6 +25,11 @@ spec = parallel $ do
ranges = actualLineRanges (totalRange source) source in ranges = actualLineRanges (totalRange source) source in
sourceSpanToRange source <$> spans `shouldBe` ranges sourceSpanToRange source <$> spans `shouldBe` ranges
prop "computes multi-line ranges" $
\ s -> let source = fromList s
ranges = actualLineRanges (totalRange source) source in
sourceSpanToRange source (totalSpan source) `shouldBe` totalRange source
describe "totalSpan" $ do describe "totalSpan" $ do
prop "covers single lines" $ prop "covers single lines" $
\ n -> totalSpan (fromList (replicate n '*')) `shouldBe` SourceSpan "" (SourcePos 0 0) (SourcePos 0 (max 0 n)) \ n -> totalSpan (fromList (replicate n '*')) `shouldBe` SourceSpan "" (SourcePos 0 0) (SourcePos 0 (max 0 n))