Verified Commit 036ec424 authored by Camil Staps's avatar Camil Staps 🚀

Adapt to new platform

parent 3f2db21c
Pipeline #12585 failed with stage
in 32 seconds
...@@ -27,9 +27,16 @@ import Testing.TestEvents ...@@ -27,9 +27,16 @@ import Testing.TestEvents
from Text import <+, class Text(join,replaceSubString,split,trim), instance Text String from Text import <+, class Text(join,replaceSubString,split,trim), instance Text String
import Text.GenJSON import Text.GenJSON
import Text.GenParse import Text.GenParse
import Text.GenPrint
import Text.Language import Text.Language
derive gDiff GenConsAssoc, Maybe derive gDiff GenConsAssoc, Maybe, JSONNode
derive gPrint Expression, JSONNode
gDiff{|Expression|} x y = case (x,y) of
(JSON x, JSON y) -> gDiff{|*|} x y
(GPrint x, GPrint y) -> gDiff{|*|} (preParseString x) (preParseString y)
_ -> simpleDiff (printToString x) (printToString y)
gDiff{|Expr|} x y = case (x,y) of gDiff{|Expr|} x y = case (x,y) of
(ExprInt a, ExprInt b) -> gDiff{|*|} a b (ExprInt a, ExprInt b) -> gDiff{|*|} a b
...@@ -63,13 +70,13 @@ gDiff{|Expr|} x y = case (x,y) of ...@@ -63,13 +70,13 @@ gDiff{|Expr|} x y = case (x,y) of
parentStatus :: [Diff] -> DiffStatus parentStatus :: [Diff] -> DiffStatus
parentStatus diffs = if (all (\d -> d.status == Common) field_diffs) Common Changed parentStatus diffs = if (all (\d -> d.status == Common) field_diffs) Common Changed
_ -> simple x y _ -> simpleDiff (toString x) (toString y)
where
simple :: Expr Expr -> [Diff] simpleDiff :: !String !String -> [Diff]
simple left right = simpleDiff left right =
[ {status=OnlyLeft, value=toString left, children=[]} [ {status=OnlyLeft, value=left, children=[]}
, {status=OnlyRight, value=toString right, children=[]} , {status=OnlyRight, value=right, children=[]}
] ]
:: *ProcessOutput = :: *ProcessOutput =
{ lines :: ![String] { lines :: ![String]
...@@ -389,7 +396,7 @@ where ...@@ -389,7 +396,7 @@ where
where where
printFA :: FailedAssertion -> String printFA :: FailedAssertion -> String
printFA (ExpectedRelation x rel y) = "Expected " +++ toString rel +++ " on:\n" +++ case rel of printFA (ExpectedRelation x rel y) = "Expected " +++ toString rel +++ " on:\n" +++ case rel of
Eq -> diffToConsole $ gDiff{|*|} (preParseString x) (preParseString y) Eq -> diffToConsole $ gDiff{|*|} x y
_ -> toString x +++ "\n" +++ toString y _ -> toString x +++ "\n" +++ toString y
printCE :: CounterExample -> String printCE :: CounterExample -> String
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment