mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Only allow comparisons between terms with the same category.
This commit is contained in:
parent
be3f43702b
commit
83a88d0e32
@ -29,8 +29,9 @@ spec = parallel $ do
|
||||
\ (grams, d) -> length (featureVector d (fromList (grams :: [Gram Text]))) `shouldBe` d
|
||||
|
||||
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 ((Just .) . (pure .) . Replace) identity tas tbs :: [Diff Text Category]))) in
|
||||
diff = free (Free (pure Program :< Indexed (rws compare identity tas tbs :: [Diff Text Category]))) in
|
||||
(beforeTerm diff, afterTerm diff) `shouldBe` (Just (cofree (Program :< Indexed tas)), Just (cofree (Program :< Indexed tbs)))
|
||||
|
Loading…
Reference in New Issue
Block a user