Skip to content

Commit

Permalink
Fix golden test framework
Browse files Browse the repository at this point in the history
This fixes the following issue:

    Query_GetGenesisConfig:             FAIL
      Exception thrown by encoder doesn't match the golden CBOR output
      Exception:
      ShelleyEncoderUnsupportedQuery (SomeBlock GetGenesisConfig) ShelleyNodeToClientVersion2 ShelleyNodeToClientVersion1
      Golden term:
      [TkBytes "helleyEncoderUnsupp",TkString "rtedQuery (Some",TkBytes "lo",TkString "k G",TkString "tGene",TkString "isConfig) ShelleyNo",TkString "eToC",TkString "ientVersion2",TkInt (-1),TkBytes "helleyNodeToClientV",TkString "rsion",TkInt (-18)]
  • Loading branch information
mrBliss committed Oct 26, 2020
1 parent 82d6922 commit 5a7dcc3
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -122,7 +122,13 @@ goldenTestCBOR testName example enc goldenFile =
. enc
$ example
return $ case (actualRes, decodeAsFlatTerm golden) of
(Left e, Right goldenFlatTerm) -> Just $ unlines [
(Left e, Right goldenFlatTerm)
-- Encoder threw an exception and the golden output was valid
-- CBOR. However, sometimes the 'show'n exception is also valid
-- CBOR. So if the exception and the golden output match, the test
-- passes.
| exceptionToByteString e == golden -> Nothing
| otherwise -> Just $ unlines [
"Exception thrown by encoder doesn't match the golden CBOR output"
, "Exception:"
, show e
Expand Down

0 comments on commit 5a7dcc3

Please sign in to comment.