Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Support comparing shown strings
Browse files Browse the repository at this point in the history
When things differ by only whitespace, it can be impossible to locate.
Now we can flip on an environment variable to make something that can at
least be compared, albeit ugly.
  • Loading branch information
pbrisbin committed Jul 11, 2023
1 parent 190a77c commit 59b2c19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions restylers/src/Restylers/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Restylers.Info.Test
import qualified Restylers.Info.Test as Test
import qualified Restylers.Manifest as Manifest
import Restylers.Name (RestylerName (..))
import System.Environment (withArgs)
import System.Environment (lookupEnv, withArgs)
import Test.Hspec

testRestylers
Expand All @@ -35,6 +35,7 @@ testRestylers
testRestylers restylers hspecArgs = do
cwd <- getCurrentDirectory
chd <- getCurrentHostDirectory
rts <- liftIO $ maybe False (not . null) <$> lookupEnv "RESTYLERS_TEST_SHOW"

withTempDirectory cwd "restylers-test" $ \tmp ->
withCurrentDirectory tmp $ do
Expand Down Expand Up @@ -76,7 +77,10 @@ testRestylers restylers hspecArgs = do
(Manifest.name restyler)
(Manifest.include restyler)
test
restyled `shouldBe` Test.restyled test

if rts
then show restyled `shouldBe` show (Test.restyled test)
else restyled `shouldBe` Test.restyled test

restylerTests :: Manifest.Restyler -> [(Int, Test.Test)]
restylerTests = zip [1 ..] . Metadata.tests . Manifest.metadata
Expand Down

0 comments on commit 59b2c19

Please sign in to comment.