Skip to content

Commit 4918389

Browse files
committed
Revert "Remove the bytestring dependency"
This reverts commit 6b28e09.
1 parent 6b28e09 commit 4918389

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

github-actions.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ test-suite spec
8282
other-modules: Language.Github.Actions.WorkflowTest
8383
build-tool-depends: tasty-discover:tasty-discover ^>=4.2.2
8484
build-depends:
85+
, bytestring ==0.11.5.3 || ==0.12.1.0
8586
, filepath ^>=1.4 || ^>=1.5
8687
, github-actions
8788
, pretty-show ^>=1.10

test/Language/Github/Actions/WorkflowTest.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ module Language.Github.Actions.WorkflowTest where
66

77
import qualified Data.Aeson as Aeson
88
import Data.Bifunctor (first)
9+
import qualified Data.ByteString as BS
910
import Data.List (isPrefixOf)
1011
import qualified Data.Text as Text
11-
import Data.Text.Encoding (decodeUtf8)
12+
import Data.Text.Encoding (encodeUtf8)
1213
import qualified Data.Yaml as Yaml
1314
import Hedgehog (Gen, Property, forAll, property, tripping)
1415
import Language.Github.Actions.Workflow (Workflow)
@@ -49,13 +50,13 @@ test_goldenWorkflowFromYaml = do
4950
putStrLn $ "roundtrip " <> takeBaseName testYamlFilePath
5051
eitherWorkflow <- Yaml.decodeFileEither @Workflow testYamlFilePath
5152
either
52-
(writeFile outputFilePath >> (\e -> fail $ "YAML decoding failed: " ++ show e))
53+
(BS.writeFile outputFilePath >> (\e -> fail $ "YAML decoding failed: " ++ show e))
5354
(\workflow -> writeOutputFiles outputFilePath haskellOutputFilePath workflow >> pure workflow)
54-
$ first Yaml.prettyPrintParseException eitherWorkflow
55+
$ first (encodeUtf8 . Text.pack . Yaml.prettyPrintParseException) eitherWorkflow
5556
writeOutputFiles :: FilePath -> FilePath -> Workflow -> IO ()
5657
writeOutputFiles outputFilePath haskellOutputFilePath workflow = do
57-
writeFile outputFilePath (Text.unpack . decodeUtf8 $ Yaml.encode workflow)
58-
>> writeFile haskellOutputFilePath (ppShow workflow)
58+
BS.writeFile outputFilePath (Yaml.encode workflow)
59+
>> BS.writeFile haskellOutputFilePath (encodeUtf8 . Text.pack $ ppShow workflow)
5960

6061
hprop_WorkflowRoundTrip :: Property
6162
hprop_WorkflowRoundTrip =

0 commit comments

Comments
 (0)