Use Text for test names
This commit is contained in:
parent
3721c27c32
commit
f634b9b42d
@ -30,7 +30,7 @@ tests :: TestTree IO ()
|
|||||||
tests =
|
tests =
|
||||||
test "tests" pure $
|
test "tests" pure $
|
||||||
enumerate <&> \isRealData@(bool "examples" "real" -> t) ->
|
enumerate <&> \isRealData@(bool "examples" "real" -> t) ->
|
||||||
test (mkTestName t) pure $
|
test (mkTestName $ T.pack t) pure $
|
||||||
[ Day1.puzzle
|
[ Day1.puzzle
|
||||||
, Day2.puzzle
|
, Day2.puzzle
|
||||||
, Day3.puzzle
|
, Day3.puzzle
|
||||||
@ -44,7 +44,7 @@ tests =
|
|||||||
]
|
]
|
||||||
<&> \Puzzle{number = show -> pt, parser, parts, extraTests} ->
|
<&> \Puzzle{number = show -> pt, parser, parts, extraTests} ->
|
||||||
testLazy
|
testLazy
|
||||||
(mkTestName pt)
|
(mkTestName $ T.pack pt)
|
||||||
( \() -> do
|
( \() -> do
|
||||||
let fp = "../inputs/" <> t <> "/" <> pt
|
let fp = "../inputs/" <> t <> "/" <> pt
|
||||||
input <-
|
input <-
|
||||||
@ -58,7 +58,7 @@ tests =
|
|||||||
)
|
)
|
||||||
$ ( finites <&> \(n@(show . succ @Int . fromIntegral -> nt)) ->
|
$ ( finites <&> \(n@(show . succ @Int . fromIntegral -> nt)) ->
|
||||||
test
|
test
|
||||||
(mkTestName nt)
|
(mkTestName $ T.pack nt)
|
||||||
(\(_, rs, _) -> golden ("../outputs/" <> t <> "/" <> pt <> "/" <> nt) $ rs n <> "\n")
|
(\(_, rs, _) -> golden ("../outputs/" <> t <> "/" <> pt <> "/" <> nt) $ rs n <> "\n")
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -286,10 +286,10 @@ data TestFailure
|
|||||||
| GoldenFailure {expected :: Text, actual :: Text}
|
| GoldenFailure {expected :: Text, actual :: Text}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
newtype TestName = TestName String
|
newtype TestName = TestName Text
|
||||||
deriving newtype (IsString, Show)
|
deriving newtype (IsString, Show)
|
||||||
|
|
||||||
mkTestName :: String -> TestName
|
mkTestName :: Text -> TestName
|
||||||
mkTestName = TestName
|
mkTestName = TestName
|
||||||
|
|
||||||
getTestTree :: TestTree m r -> Tree TestName
|
getTestTree :: TestTree m r -> Tree TestName
|
||||||
@ -319,7 +319,7 @@ displayTestResultsConsole terminalWidth testResult =
|
|||||||
<> T.singleton icon
|
<> T.singleton icon
|
||||||
<> " "
|
<> " "
|
||||||
<> setColour Dull White
|
<> setColour Dull White
|
||||||
<> T.pack name
|
<> name
|
||||||
<> maybe
|
<> maybe
|
||||||
mempty
|
mempty
|
||||||
( \_t@(showTime -> tt) ->
|
( \_t@(showTime -> tt) ->
|
||||||
@ -327,7 +327,7 @@ displayTestResultsConsole terminalWidth testResult =
|
|||||||
( fromIntegral $
|
( fromIntegral $
|
||||||
maybe
|
maybe
|
||||||
3
|
3
|
||||||
(\n -> n - (2 * indent + length name + T.length tt + 2))
|
(\n -> n - (2 * indent + T.length name + T.length tt + 2))
|
||||||
terminalWidth
|
terminalWidth
|
||||||
)
|
)
|
||||||
" "
|
" "
|
||||||
|
|||||||
@ -41,7 +41,7 @@ puzzle =
|
|||||||
in map
|
in map
|
||||||
( \n ->
|
( \n ->
|
||||||
test
|
test
|
||||||
(mkTestName $ show n)
|
(mkTestName $ T.show n)
|
||||||
( \frames -> do
|
( \frames -> do
|
||||||
g <- lookupFrame n frames
|
g <- lookupFrame n frames
|
||||||
golden (path <> "frames/" <> show n) $ drawGrid g
|
golden (path <> "frames/" <> show n) $ drawGrid g
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user