2015-12-16 22:18:09 +03:00
|
|
|
module InterpreterSpec where
|
|
|
|
|
2016-05-26 20:11:34 +03:00
|
|
|
import Prologue
|
2016-04-12 11:54:32 +03:00
|
|
|
import Diff
|
2015-12-16 22:18:09 +03:00
|
|
|
import qualified Interpreter as I
|
|
|
|
import Range
|
|
|
|
import Syntax
|
|
|
|
import Patch
|
2016-03-31 00:33:07 +03:00
|
|
|
import Info
|
2016-02-04 21:59:33 +03:00
|
|
|
import Category
|
2015-12-16 22:18:09 +03:00
|
|
|
import Test.Hspec
|
|
|
|
|
|
|
|
spec :: Spec
|
2016-05-04 22:15:25 +03:00
|
|
|
spec = parallel $
|
|
|
|
describe "interpret" $
|
2015-12-16 22:18:09 +03:00
|
|
|
it "returns a replacement when comparing two unicode equivalent terms" $
|
2016-06-03 09:59:48 +03:00
|
|
|
I.diffTerms (free . Free) ((==) `on` extract) diffCost (cofree (Info range StringLiteral 0 0 :< Leaf "t\776")) (cofree (Info range2 StringLiteral 0 0 :< Leaf "\7831")) `shouldBe`
|
2016-06-03 06:34:16 +03:00
|
|
|
free (Pure (Replace (cofree (Info range StringLiteral 0 0 :< Leaf "t\776")) (cofree (Info range2 StringLiteral 0 0 :< Leaf "\7831"))))
|
2015-12-16 22:18:09 +03:00
|
|
|
|
|
|
|
where
|
|
|
|
range = Range 0 2
|
|
|
|
range2 = Range 0 1
|