mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
fix tests
This commit is contained in:
parent
e51492b8d5
commit
f5dadfd964
@ -77,7 +77,7 @@ main = hspec $ do
|
||||
it "should split multi-line deletions across multiple rows" $
|
||||
let (sourceA, sourceB) = ("/*\n*/\na", "a") in
|
||||
annotatedToRows (formatted sourceA sourceB "branch" (Indexed [
|
||||
Pure . Delete $ (Info (Range 0 5) (Range 0 2) (Set.fromList ["leaf"]) :< (Leaf "")),
|
||||
Pure . Delete $ (Info (Range 0 5) (Set.fromList ["leaf"]) :< (Leaf "")),
|
||||
Free . offsetAnnotated 6 0 $ unchanged "a" "leaf" (Leaf "")
|
||||
])) sourceA sourceB `shouldBe`
|
||||
([
|
||||
@ -109,7 +109,7 @@ main = hspec $ do
|
||||
|
||||
describe "termToLines" $ do
|
||||
it "splits multi-line terms into multiple lines" $
|
||||
termToLines (Info (Range 0 5) (Range 0 2) (Set.singleton "leaf") :< (Leaf "")) "/*\n*/"
|
||||
termToLines (Info (Range 0 5) (Set.singleton "leaf") :< (Leaf "")) "/*\n*/"
|
||||
`shouldBe`
|
||||
([
|
||||
Line [ span "/*", Break ],
|
||||
@ -135,9 +135,9 @@ main = hspec $ do
|
||||
leftRowText text = leftRow [ Text text ]
|
||||
leftRow xs = Row (Line xs) EmptyLine
|
||||
rowText a b = Row (Line [ Text a ]) (Line [ Text b ])
|
||||
info source category = Info (totalRange source) (Range 0 0) (Set.fromList [ category ])
|
||||
info source category = Info (totalRange source) (Set.fromList [ category ])
|
||||
unchanged source category = formatted source source category
|
||||
formatted source1 source2 category = Annotated (info source1 category, info source2 category)
|
||||
offsetInfo by (Info (Range start end) lineRange categories) = Info (Range (start + by) (end + by)) lineRange categories
|
||||
offsetInfo by (Info (Range start end) categories) = Info (Range (start + by) (end + by)) categories
|
||||
offsetAnnotated by1 by2 (Annotated (left, right) syntax) = Annotated (offsetInfo by1 left, offsetInfo by2 right) syntax
|
||||
span = Span (Just "category-leaf")
|
||||
|
Loading…
Reference in New Issue
Block a user