NorfairKing / sydtest

A modern testing framework for Haskell with good defaults and advanced testing features.
113 stars 25 forks source link

Incorrect printing of Unicode in text of `shouldBe` #52

Closed jfaure closed 2 years ago

jfaure commented 2 years ago
it "←“  $ "→“ `shouldBe` "->""

the description "←" prints fine, but for Actual and Expected fields the text is shown, resulting in "\8594" instead of "→"

NorfairKing commented 2 years ago

@jfaure This may be a wontfix, because shouldBe can't know if what you're comparing is text or something else. However, you can throw your own assertion if you like: https://hackage.haskell.org/package/sydtest-0.11.0.0/docs/Test-Syd-Run.html#t:Assertion

jfaure commented 2 years ago

Easiest workaround is wrapping the shouldBe args in a newtype

newtype UniText = UniText Data.Text.Text deriving Eq
instance Show UniText where show (UniText l) = Data.Text.unpack l