1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Generate a pair of inputs.

This allows scaling to work correctly.
This commit is contained in:
Rob Rix 2016-06-30 12:37:27 -04:00
parent 1a35975c4f
commit a5af331f71

View File

@ -32,9 +32,9 @@ spec = parallel $ do
describe "rws" $ do
let compare a b = if extract a == extract b then Just (pure (Replace a b)) else Nothing
prop "produces correct diffs" $
\ as bs -> let tas = toTerm <$> as
tbs = toTerm <$> bs
diff = free (Free (pure Program :< Indexed (rws compare identity tas tbs :: [Diff Text Category]))) in
\ (as, bs) -> let tas = toTerm <$> as
tbs = toTerm <$> bs
diff = free (Free (pure Program :< Indexed (rws compare identity tas tbs :: [Diff Text Category]))) in
(childrenOf <$> beforeTerm diff, childrenOf <$> afterTerm diff) `shouldBe` (Just (Set.fromList tas), Just (Set.fromList tbs))
childrenOf :: (Ord leaf, Ord annotation) => Term leaf annotation -> Set.Set (Term leaf annotation)