mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Extract alignment from the property test.
This commit is contained in:
parent
5c1b0809ec
commit
6caf9d3930
@ -54,10 +54,7 @@ spec = parallel $ do
|
||||
pendingWith "TBD"
|
||||
|
||||
prop "covers every input child" $
|
||||
\ elements ->
|
||||
let (_, ranges) = toSourcesAndRanges elements
|
||||
children = toAlignedChildren elements in
|
||||
sort (nub (keysOfAlignedChildren (alignBranch id children ranges))) `shouldBe` sort (catMaybes (branchElementKey <$> elements))
|
||||
\ elements -> sort (nub (keysOfAlignedChildren (alignmentFromBranchElements elements))) `shouldBe` sort (catMaybes (branchElementKey <$> elements))
|
||||
|
||||
prop "covers every line of every input child" $
|
||||
pendingWith "TBD"
|
||||
@ -192,6 +189,11 @@ data BranchElement
|
||||
| Margin (Join These String)
|
||||
deriving Show
|
||||
|
||||
alignmentFromBranchElements :: [BranchElement] -> [Join These (Range, [(String, Range)])]
|
||||
alignmentFromBranchElements elements = alignBranch id children ranges
|
||||
where (_, ranges) = toSourcesAndRanges elements
|
||||
children = toAlignedChildren elements
|
||||
|
||||
branchElementContents :: BranchElement -> Join These String
|
||||
branchElementContents (Child _ contents) = contents
|
||||
branchElementContents (Margin contents) = contents
|
||||
|
Loading…
Reference in New Issue
Block a user