Skip to content

Commit bf43266

Browse files
committed
stuff
1 parent dc39bfc commit bf43266

File tree

7 files changed

+54
-33
lines changed

7 files changed

+54
-33
lines changed

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxOut/Gen.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import Cardano.Api hiding (Value)
2525

2626
import Data.Aeson (Value (..), object, (.=))
2727

28+
import Test.Gen.Cardano.Api.Typed
29+
2830
import Hedgehog (Gen)
2931
import Hedgehog.Gen qualified as Gen
3032

31-
import Test.Gen.Cardano.Api.Typed
32-
3333
-- | Generate a TxOut with no datum and no reference script
3434
genTxOutWithNoDatum
3535
:: ShelleyBasedEra era

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxOut/Helpers.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ where
2828

2929
import Cardano.Api hiding (Value)
3030

31+
import Control.Monad (unless)
3132
import Data.Aeson (Object, Value (..))
3233
import Data.Aeson qualified as Aeson
3334
import Data.Aeson.Key qualified as Aeson.Key
@@ -36,7 +37,6 @@ import Data.Text (Text)
3637
import Data.Text qualified as Text
3738
import GHC.Stack (HasCallStack, callStack)
3839

39-
import Control.Monad (unless)
4040
import Hedgehog.Extras qualified as H
4141
import Hedgehog.Internal.Property (MonadTest)
4242

@@ -66,7 +66,8 @@ assertFieldPresent (Object obj) field expected = do
6666
<> "\nActual: "
6767
<> show actual
6868
assertFieldPresent val field _ =
69-
H.failMessage callStack $ "Expected Object but got: " <> show val <> " when checking field " <> Text.unpack field
69+
H.failMessage callStack $
70+
"Expected Object but got: " <> show val <> " when checking field " <> Text.unpack field
7071

7172
-- | Assert that a field equals a specific value (same as assertFieldPresent)
7273
assertFieldEquals :: (MonadTest m, HasCallStack) => Value -> Text -> Value -> m ()
@@ -83,7 +84,8 @@ assertFieldNull (Object obj) field = do
8384
H.failMessage callStack $
8485
"Field '" <> Text.unpack field <> "' is not null, got: " <> show val
8586
assertFieldNull val field =
86-
H.failMessage callStack $ "Expected Object but got: " <> show val <> " when checking field " <> Text.unpack field
87+
H.failMessage callStack $
88+
"Expected Object but got: " <> show val <> " when checking field " <> Text.unpack field
8789

8890
-- | Assert that all specified fields are null
8991
assertAllNull :: (MonadTest m, HasCallStack) => Value -> [Text] -> m ()
@@ -98,7 +100,8 @@ assertParseFails val =
98100
Aeson.Error _ -> return ()
99101

100102
-- | Assert that parsing fails with a message containing the specified text
101-
assertParseFailsWithMessage :: forall a m. (Aeson.FromJSON a, MonadTest m, HasCallStack) => Value -> Text -> m ()
103+
assertParseFailsWithMessage
104+
:: forall a m. (Aeson.FromJSON a, MonadTest m, HasCallStack) => Value -> Text -> m ()
102105
assertParseFailsWithMessage val expectedMsg =
103106
case Aeson.fromJSON val of
104107
Aeson.Success (_ :: a) ->

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxOut/Json.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ module Test.Cardano.Api.TxOut.Json
1717
)
1818
where
1919

20-
import Test.Tasty (TestTree, testGroup)
21-
2220
import Test.Cardano.Api.TxOut.JsonEdgeCases qualified as EdgeCases
2321
import Test.Cardano.Api.TxOut.JsonErrorCases qualified as ErrorCases
2422
import Test.Cardano.Api.TxOut.JsonRoundtrip qualified as Roundtrip
2523

24+
import Test.Tasty (TestTree, testGroup)
25+
2626
-- | All TxOut JSON tests
2727
tests :: TestTree
2828
tests =

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxOut/JsonEdgeCases.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ import Cardano.Api hiding (Value)
1414

1515
import Data.Aeson (Value (..), eitherDecode, encode, object, (.=))
1616

17-
import Hedgehog (Property, forAll)
18-
import Hedgehog qualified as H
1917
import Test.Gen.Cardano.Api.Typed
20-
import Test.Tasty (TestTree, testGroup)
21-
import Test.Tasty.Hedgehog (testPropertyNamed)
2218

2319
import Test.Cardano.Api.TxOut.Gen
2420
import Test.Cardano.Api.TxOut.Helpers
2521

22+
import Hedgehog (Property, forAll)
23+
import Hedgehog qualified as H
24+
import Test.Tasty (TestTree, testGroup)
25+
import Test.Tasty.Hedgehog (testPropertyNamed)
26+
2627
-- | All edge case tests
2728
tests :: TestTree
2829
tests =

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxOut/JsonErrorCases.hs

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ import Cardano.Api hiding (Value)
1313

1414
import Data.Aeson (object, (.=))
1515

16-
import Hedgehog (Property, forAll)
17-
import Hedgehog qualified as H
1816
import Test.Gen.Cardano.Api.Typed
19-
import Test.Tasty (TestTree, testGroup)
20-
import Test.Tasty.Hedgehog (testPropertyNamed)
2117

2218
import Test.Cardano.Api.TxOut.Gen
2319
import Test.Cardano.Api.TxOut.Helpers
2420

21+
import Hedgehog (Property, forAll)
22+
import Hedgehog qualified as H
23+
import Test.Tasty (TestTree, testGroup)
24+
import Test.Tasty.Hedgehog (testPropertyNamed)
25+
2526
-- | All error case tests
2627
tests :: TestTree
2728
tests =
@@ -48,17 +49,19 @@ testsConflictingDatums =
4849
"Conway: reject conflicting Alonzo and Conway datums"
4950
"prop_reject_conflicting_datums_conway"
5051
prop_reject_conflicting_datums_conway
51-
-- Dijkstra era not yet supported in shelleyBasedEraConstraints
52-
-- , testPropertyNamed
53-
-- "Dijkstra: reject conflicting Alonzo and Dijkstra datums"
54-
-- "prop_reject_conflicting_datums_dijkstra"
55-
-- prop_reject_conflicting_datums_dijkstra
52+
-- Dijkstra era not yet supported in shelleyBasedEraConstraints
53+
-- , testPropertyNamed
54+
-- "Dijkstra: reject conflicting Alonzo and Dijkstra datums"
55+
-- "prop_reject_conflicting_datums_dijkstra"
56+
-- prop_reject_conflicting_datums_dijkstra
5657
]
5758

5859
prop_reject_conflicting_datums_babbage :: Property
5960
prop_reject_conflicting_datums_babbage = H.property $ do
6061
json <- forAll genConflictingDatumJSON
61-
assertParseFailsWithMessage @(TxOut CtxTx BabbageEra) json "Alonzo era datum and a Babbage era datum"
62+
assertParseFailsWithMessage @(TxOut CtxTx BabbageEra)
63+
json
64+
"Alonzo era datum and a Babbage era datum"
6265

6366
prop_reject_conflicting_datums_conway :: Property
6467
prop_reject_conflicting_datums_conway = H.property $ do
@@ -98,22 +101,30 @@ testsMismatchedHashes =
98101
prop_reject_mismatched_hash_babbage_ctx_tx :: Property
99102
prop_reject_mismatched_hash_babbage_ctx_tx = H.property $ do
100103
json <- forAll genMismatchedInlineDatumHashJSON
101-
assertParseFailsWithMessage @(TxOut CtxTx BabbageEra) json "Inline datum not equivalent to inline datum hash"
104+
assertParseFailsWithMessage @(TxOut CtxTx BabbageEra)
105+
json
106+
"Inline datum not equivalent to inline datum hash"
102107

103108
prop_reject_mismatched_hash_babbage_ctx_utxo :: Property
104109
prop_reject_mismatched_hash_babbage_ctx_utxo = H.property $ do
105110
json <- forAll genMismatchedInlineDatumHashJSON
106-
assertParseFailsWithMessage @(TxOut CtxUTxO BabbageEra) json "Inline datum not equivalent to inline datum hash"
111+
assertParseFailsWithMessage @(TxOut CtxUTxO BabbageEra)
112+
json
113+
"Inline datum not equivalent to inline datum hash"
107114

108115
prop_reject_mismatched_hash_conway_ctx_tx :: Property
109116
prop_reject_mismatched_hash_conway_ctx_tx = H.property $ do
110117
json <- forAll genMismatchedInlineDatumHashJSON
111-
assertParseFailsWithMessage @(TxOut CtxTx ConwayEra) json "Inline datum not equivalent to inline datum hash"
118+
assertParseFailsWithMessage @(TxOut CtxTx ConwayEra)
119+
json
120+
"Inline datum not equivalent to inline datum hash"
112121

113122
prop_reject_mismatched_hash_conway_ctx_utxo :: Property
114123
prop_reject_mismatched_hash_conway_ctx_utxo = H.property $ do
115124
json <- forAll genMismatchedInlineDatumHashJSON
116-
assertParseFailsWithMessage @(TxOut CtxUTxO ConwayEra) json "Inline datum not equivalent to inline datum hash"
125+
assertParseFailsWithMessage @(TxOut CtxUTxO ConwayEra)
126+
json
127+
"Inline datum not equivalent to inline datum hash"
117128

118129
-- -----------------------------------------------------------------------------
119130
-- Partial Field Tests
@@ -138,17 +149,23 @@ testsPartialFields =
138149
prop_reject_partial_inline_datum_babbage_ctx_tx :: Property
139150
prop_reject_partial_inline_datum_babbage_ctx_tx = H.property $ do
140151
json <- forAll genPartialInlineDatumJSON
141-
assertParseFailsWithMessage @(TxOut CtxTx BabbageEra) json "either an inline datum hash or an inline datum"
152+
assertParseFailsWithMessage @(TxOut CtxTx BabbageEra)
153+
json
154+
"either an inline datum hash or an inline datum"
142155

143156
prop_reject_partial_inline_datum_babbage_ctx_utxo :: Property
144157
prop_reject_partial_inline_datum_babbage_ctx_utxo = H.property $ do
145158
json <- forAll genPartialInlineDatumJSON
146-
assertParseFailsWithMessage @(TxOut CtxUTxO BabbageEra) json "either an inline datum hash or an inline datum"
159+
assertParseFailsWithMessage @(TxOut CtxUTxO BabbageEra)
160+
json
161+
"either an inline datum hash or an inline datum"
147162

148163
prop_reject_partial_inline_datum_conway_ctx_tx :: Property
149164
prop_reject_partial_inline_datum_conway_ctx_tx = H.property $ do
150165
json <- forAll genPartialInlineDatumJSON
151-
assertParseFailsWithMessage @(TxOut CtxTx ConwayEra) json "either an inline datum hash or an inline datum"
166+
assertParseFailsWithMessage @(TxOut CtxTx ConwayEra)
167+
json
168+
"either an inline datum hash or an inline datum"
152169

153170
-- -----------------------------------------------------------------------------
154171
-- Invalid Data Tests

cardano-api/test/cardano-api-test/Test/Cardano/Api/TxOut/JsonRoundtrip.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import Cardano.Api
1111

1212
import Data.Aeson (eitherDecode, encode)
1313

14+
import Test.Gen.Cardano.Api.Typed
15+
16+
import Test.Cardano.Api.TxOut.Gen
17+
1418
import Hedgehog (Property, forAll, tripping)
1519
import Hedgehog qualified as H
16-
import Test.Gen.Cardano.Api.Typed
1720
import Test.Tasty (TestTree, testGroup)
1821
import Test.Tasty.Hedgehog (testProperty)
1922

20-
import Test.Cardano.Api.TxOut.Gen
21-
2223
-- | All roundtrip tests
2324
tests :: TestTree
2425
tests =

cardano-wasm/test/cardano-wasm-golden/cardano-wasm-golden.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
#else
66
main = return ()
77
#endif
8-

0 commit comments

Comments
 (0)