Skip to content

Commit 465361b

Browse files
committed
Remove EraSpecificSpec
1 parent 8f142fa commit 465361b

20 files changed

Lines changed: 73 additions & 93 deletions

File tree

eras/allegra/impl/test/Main.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ import qualified Test.Cardano.Ledger.Allegra.Imp as Imp
1111
import Test.Cardano.Ledger.Allegra.ImpTest ()
1212
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
1313
import Test.Cardano.Ledger.Era
14+
import qualified Test.Cardano.Ledger.Shelley.Imp as Imp (shelleyEraSpecificSpec)
1415
import Test.Cardano.Ledger.Shelley.JSON (roundTripJsonShelleyEraSpec)
1516

1617
instance EraSpec AllegraEra where
17-
eraImpSpec = Imp.spec
18+
eraImpSpec era = do
19+
Imp.shelleyEraSpecificSpec era
20+
Imp.spec era
1821

1922
main :: IO ()
2023
main =

eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/Imp.hs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,18 @@
66

77
module Test.Cardano.Ledger.Allegra.Imp (spec) where
88

9-
import Cardano.Ledger.Allegra (AllegraEra)
109
import Cardano.Ledger.Core
1110
import Cardano.Ledger.Shelley.Rules
1211
import Test.Cardano.Ledger.Allegra.ImpTest
1312
import Test.Cardano.Ledger.Imp.Common
14-
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp
13+
import qualified Test.Cardano.Ledger.Shelley.Imp as Shelley
1514

1615
spec ::
1716
( ShelleyEraImp era
18-
, EraSpecificSpec era
1917
, Event (EraRule "RUPD" era) ~ RupdEvent
2018
) =>
2119
proxy era ->
2220
Spec
2321
spec era = do
24-
ShelleyImp.spec era
25-
26-
instance EraSpecificSpec AllegraEra where
27-
eraSpecificSpec = ShelleyImp.shelleyEraSpecificSpec
22+
Shelley.spec era
23+
describe "AllegraEra Onwards" $ pure ()

eras/alonzo/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
### `testlib`
4646

47+
* Add `proxy era` argument to `alonzoEraSpecificSpec`
4748
* Make `Test.Cardano.Ledger.Alonzo.Imp.spec` accept `Proxy era`
4849
* Add `genDatumPresent`
4950
* Added `Proxy era` argument to `exUnitsRule`

eras/alonzo/impl/test/Main.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ import Test.Cardano.Ledger.Alonzo.ImpTest ()
1717
import Test.Cardano.Ledger.Common
1818
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
1919
import Test.Cardano.Ledger.Era
20+
import qualified Test.Cardano.Ledger.Shelley.Imp as Shelley
2021
import Test.Cardano.Ledger.Shelley.JSON (roundTripJsonShelleyEraSpec)
2122

2223
instance EraSpec AlonzoEra where
23-
eraImpSpec = Imp.spec
24+
eraImpSpec era = do
25+
Shelley.shelleyEraSpecificSpec era
26+
Imp.alonzoEraSpecificSpec era
27+
Imp.spec era
2428

2529
main :: IO ()
2630
main =

eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp.hs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
module Test.Cardano.Ledger.Alonzo.Imp where
77

8-
import Cardano.Ledger.Alonzo (AlonzoEra)
98
import Cardano.Ledger.Core
109
import Cardano.Ledger.Shelley.Core (ShelleyEraTxCert)
1110
import Cardano.Ledger.Shelley.Rules
@@ -15,31 +14,26 @@ import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxosSpec as Utxos
1514
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxowSpec as Utxow
1615
import Test.Cardano.Ledger.Alonzo.ImpTest
1716
import Test.Cardano.Ledger.Imp.Common
18-
import qualified Test.Cardano.Ledger.Mary.Imp as MaryImp
19-
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp
17+
import qualified Test.Cardano.Ledger.Mary.Imp as Mary
2018

2119
spec ::
2220
( AlonzoEraImp era
23-
, EraSpecificSpec era
2421
, Event (EraRule "RUPD" era) ~ RupdEvent
2522
) =>
2623
proxy era ->
2724
Spec
2825
spec era = do
29-
MaryImp.spec era
30-
describe "AlonzoImpSpec" . withImpInitEachEraVersion era $ do
26+
Mary.spec era
27+
describe "AlonzoEra Onwards" $ withImpInitEachEraVersion era $ do
3128
Bbody.spec
3229
Utxo.spec
3330
Utxos.spec
3431
Utxow.spec
3532

3633
alonzoEraSpecificSpec ::
3734
(AlonzoEraImp era, ShelleyEraTxCert era) =>
38-
SpecWith (ImpInit (LedgerSpec era))
39-
alonzoEraSpecificSpec = do
40-
describe "From AlonzoEra" $ do
35+
proxy era ->
36+
Spec
37+
alonzoEraSpecificSpec era = withImpInitEachEraVersion era $ do
38+
describe "AlonzoEra Specific" $ do
4139
Utxow.alonzoEraSpecificSpec
42-
43-
instance EraSpecificSpec AlonzoEra where
44-
eraSpecificSpec =
45-
ShelleyImp.shelleyEraSpecificSpec >> alonzoEraSpecificSpec

eras/babbage/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
### `testlib`
3131

32+
* Add `proxy era` argument to `babbageEraSpecificSpec`
3233
* Make `Test.Cardano.Ledger.Babbage.Imp.spec` accept `Proxy era`
3334
* Add `Test.Cardano.Ledger.Babbage.Imp.PoolSpec` module with `babbageEraSpecificSpec`
3435
* In `Test.Cardano.Ledger.Babbage.Examples`:

eras/babbage/impl/test/Main.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Main where
66
import Cardano.Ledger.Babbage (BabbageEra)
77
import qualified Test.Cardano.Ledger.Alonzo.Binary.CostModelsSpec as CostModelsSpec
88
import qualified Test.Cardano.Ledger.Alonzo.Binary.TxWitsSpec as TxWitsSpec
9+
import qualified Test.Cardano.Ledger.Alonzo.Imp as Alonzo
910
import qualified Test.Cardano.Ledger.Babbage.Binary.CddlSpec as CddlSpec
1011
import qualified Test.Cardano.Ledger.Babbage.BinarySpec as BinarySpec
1112
import qualified Test.Cardano.Ledger.Babbage.GoldenSpec as Golden
@@ -16,10 +17,15 @@ import qualified Test.Cardano.Ledger.Babbage.TxInfoSpec as TxInfo
1617
import Test.Cardano.Ledger.Common
1718
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
1819
import Test.Cardano.Ledger.Era
20+
import qualified Test.Cardano.Ledger.Shelley.Imp as Shelley
1921
import Test.Cardano.Ledger.Shelley.JSON (roundTripJsonShelleyEraSpec)
2022

2123
instance EraSpec BabbageEra where
22-
eraImpSpec = Imp.spec
24+
eraImpSpec era = do
25+
Shelley.shelleyEraSpecificSpec era
26+
Alonzo.alonzoEraSpecificSpec era
27+
Imp.babbageEraSpecificSpec era
28+
Imp.spec era
2329

2430
main :: IO ()
2531
main =

eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Imp.hs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,40 @@
88
{-# LANGUAGE UndecidableInstances #-}
99
{-# OPTIONS_GHC -Wno-orphans #-}
1010

11-
module Test.Cardano.Ledger.Babbage.Imp (spec) where
11+
module Test.Cardano.Ledger.Babbage.Imp (spec, babbageEraSpecificSpec) where
1212

13-
import Cardano.Ledger.Babbage (BabbageEra)
1413
import Cardano.Ledger.Babbage.Core
1514
import Cardano.Ledger.Babbage.State
1615
import Cardano.Ledger.Shelley.Rules
17-
import qualified Test.Cardano.Ledger.Alonzo.Imp as AlonzoImp
16+
import qualified Test.Cardano.Ledger.Alonzo.Imp as Alonzo
1817
import Test.Cardano.Ledger.Alonzo.ImpTest
1918
import qualified Test.Cardano.Ledger.Babbage.Imp.PoolSpec as Pool
2019
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxoSpec as Utxo
2120
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxosSpec as Utxos
2221
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxowSpec as Utxow
2322
import Test.Cardano.Ledger.Babbage.ImpTest (BabbageEraImp)
2423
import Test.Cardano.Ledger.Imp.Common
25-
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp
2624

2725
spec ::
2826
( BabbageEraImp era
29-
, EraSpecificSpec era
3027
, Event (EraRule "RUPD" era) ~ RupdEvent
3128
) =>
3229
proxy era ->
3330
Spec
3431
spec era = do
35-
AlonzoImp.spec era
36-
withImpInitEachEraVersion era $
37-
describe "BabbageImpSpec - era generic tests" $ do
38-
Utxo.spec
39-
Utxow.spec
40-
Utxos.spec
32+
Alonzo.spec era
33+
describe "BabbageEra Onwards" $ withImpInitEachEraVersion era $ do
34+
Utxo.spec
35+
Utxow.spec
36+
Utxos.spec
4137

4238
babbageEraSpecificSpec ::
4339
( BabbageEraImp era
4440
, ShelleyEraAccounts era
4541
, Event (EraRule "NEWEPOCH" era) ~ ShelleyNewEpochEvent era
4642
) =>
47-
SpecWith (ImpInit (LedgerSpec era))
48-
babbageEraSpecificSpec = do
49-
describe "Babbage era specific Imp spec" $
50-
describe "POOL" Pool.babbageEraSpecificSpec
51-
52-
instance EraSpecificSpec BabbageEra where
53-
eraSpecificSpec =
54-
ShelleyImp.shelleyEraSpecificSpec
55-
>> AlonzoImp.alonzoEraSpecificSpec
56-
>> babbageEraSpecificSpec
43+
proxy era ->
44+
Spec
45+
babbageEraSpecificSpec era = do
46+
describe "BabbageEra Specific" $ withImpInitEachEraVersion era $ do
47+
Pool.babbageEraSpecificSpec

eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Imp/PoolSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ babbageEraSpecificSpec ::
3333
, Event (EraRule "NEWEPOCH" era) ~ ShelleyNewEpochEvent era
3434
) =>
3535
SpecWith (ImpInit (LedgerSpec era))
36-
babbageEraSpecificSpec = do
36+
babbageEraSpecificSpec = describe "POOL" $ do
3737
it "Pool to pool member rewards" $ do
3838
-- This test attempts to reproduce the issue that appeared with the release of
3939
-- `cardano-db-sync-10.6.1` (using `cardano-ledger-shelley-1.17.0.0`),

eras/conway/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
### `testlib`
4848

49+
* Export `conwayEraSpecificSpec`
4950
* Make `Test.Cardano.Ledger.Conway.Imp.spec` accept `Proxy era`
5051
* In `Test.Cardano.Ledger.Conway.Examples`:
5152
- Remove `mkConwayBasedExampleTx`, `exampleConwayBasedTxBody`

0 commit comments

Comments
 (0)