1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

Strip the diff in the replacement of unicode equivalent terms test.

This commit is contained in:
Rob Rix 2016-08-11 12:48:41 -04:00
parent 15b515e7a1
commit 3bb86389ed

View File

@ -20,9 +20,9 @@ spec = parallel $ do
let decorate = featureVectorDecorator (category . headF) 2 2 15
let compare = ((==) `on` category . extract)
it "returns a replacement when comparing two unicode equivalent terms" $
let termA = decorate . cofree $ (StringLiteral .: RNil) :< Leaf ("t\776" :: Text)
termB = decorate . cofree $ (StringLiteral .: RNil) :< Leaf "\7831" in
diffTerms wrap compare diffCost termA termB `shouldBe` free (Pure (Replace termA termB))
let termA = cofree $ (StringLiteral .: RNil) :< Leaf ("t\776" :: Text)
termB = cofree $ (StringLiteral .: RNil) :< Leaf "\7831" in
stripDiff (diffTerms wrap compare diffCost (decorate termA) (decorate termB)) `shouldBe` free (Pure (Replace termA termB))
prop "produces correct diffs" $
\ a b -> let diff = stripDiff $ diffTerms wrap compare diffCost (decorate (toTerm a)) (decorate (toTerm (b :: ArbitraryTerm Text (Record '[Category])))) in