mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
18 lines
531 B
Haskell
18 lines
531 B
Haskell
module Source.Spec where
|
|
|
|
import Prologue
|
|
import Range
|
|
import Source
|
|
import Test.Hspec
|
|
import Test.Hspec.QuickCheck
|
|
|
|
spec :: Spec
|
|
spec = parallel $ do
|
|
describe "actualLineRanges" $ do
|
|
prop "produces 1 more range than there are newlines" $
|
|
\ s -> length (actualLineRanges (totalRange s) (fromList s)) `shouldBe` succ (length (filter (== '\n') s))
|
|
|
|
prop "produces exhaustive ranges" $
|
|
\ s -> let source = fromList s in
|
|
foldMap (`slice` source) (actualLineRanges (totalRange s) source) `shouldBe` source
|