@@ -17,8 +17,8 @@ import Data.Text (Text)
1717import Data.Text qualified as T
1818import Data.Text.Encoding qualified as T
1919import Swarm.Failure (SystemFailure )
20- import Swarm.Language.Load (SyntaxWithImports (.. ))
2120import Swarm.Language.JSON ()
21+ import Swarm.Language.Load (SyntaxWithImports (.. ))
2222import Swarm.Language.Parser (readTerm )
2323import Swarm.Language.Parser.QQ (tyQ )
2424import Swarm.Language.Pipeline (processSource )
@@ -766,22 +766,22 @@ testLanguagePipeline =
766766 " Import #2540"
767767 [ testCase
768768 " simple import"
769- ( valid " import \" data/test/import/a.sw\" ; pure (a + 1)" )
769+ (valid " import \" data/test/import/a.sw\" ; pure (a + 1)" )
770770 , testCase
771771 " recursive import - unused"
772- ( valid " import \" data/test/import/b.sw\" ; pure (b + 1)" )
772+ (valid " import \" data/test/import/b.sw\" ; pure (b + 1)" )
773773 , testCase
774774 " recursive import - used"
775- ( valid " import \" data/test/import/d.sw\" ; pure (d + 1)" )
775+ (valid " import \" data/test/import/d.sw\" ; pure (d + 1)" )
776776 , testCase
777777 " recursive import is not re-exported"
778778 ( process
779- " import \" data/test/import/f.sw\" ; pure (f + g)"
780- " 1:43: Unbound variable g"
779+ " import \" data/test/import/f.sw\" ; pure (f + g)"
780+ " 1:43: Unbound variable g"
781781 )
782782 , testCase
783783 " import from URL"
784- ( valid " import \" https://raw.githubusercontent.com/byorgey/swarm-defs/refs/heads/main/defs.sw\" ; tL" )
784+ (valid " import \" https://raw.githubusercontent.com/byorgey/swarm-defs/refs/heads/main/defs.sw\" ; tL" )
785785 ]
786786 ]
787787 where
@@ -791,15 +791,16 @@ testLanguagePipeline =
791791 process = processCompare T. isPrefixOf
792792
793793 processCompare :: (Text -> Text -> Bool ) -> Text -> Text -> Assertion
794- processCompare cmp code expect = runError @ SystemFailure (processSource code Nothing ) >>= \ case
795- Left e
796- | not (T. null expect) && cmp expect (prettyText e) -> pure ()
797- | otherwise ->
798- error $
799- " Unexpected failure:\n\n " <> show (prettyText e) <> " \n\n Expected:\n\n " <> show expect <> " \n "
800- Right _
801- | expect == " " -> pure ()
802- | otherwise -> error " Unexpected success"
794+ processCompare cmp code expect =
795+ runError @ SystemFailure (processSource code Nothing ) >>= \ case
796+ Left e
797+ | not (T. null expect) && cmp expect (prettyText e) -> pure ()
798+ | otherwise ->
799+ error $
800+ " Unexpected failure:\n\n " <> show (prettyText e) <> " \n\n Expected:\n\n " <> show expect <> " \n "
801+ Right _
802+ | expect == " " -> pure ()
803+ | otherwise -> error " Unexpected success"
803804
804805-- | Check round tripping of term from and to text, then test ToJSON/FromJSON.
805806roundTripTerm :: Text -> Assertion
0 commit comments