1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Verify that sourceSpanToRange computes correct ranges within lines.

This commit is contained in:
Rob Rix 2016-09-13 15:04:17 -04:00
parent e6f4db8ee8
commit 1c335df1f0

View File

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