Skip to content

[#410] Refactor Cleveland module structure

Description

This is a (fairly large) refactoring of module structure in the cleveland package.

The following rename scheme is used:

  • Cleveland.* -> Test.Cleveland.*
  • Morley.Nettest -> Test.Cleveland
  • Morley.Nettest.Instances -> Test.Cleveland.Instances
  • Morley.Nettest.* -> Test.Cleveland.Internal.*
  • Lorentz.Test -> Test.Cleveland.Lorentz
  • Lorentz.Test.* -> Test.Cleveland.Lorentz.*
  • Lorentz.Test.Doc -> Test.Cleveland.Doc.Lorentz
  • Michelson.Test -> Test.Cleveland.Michelson
  • Michelson.Test.* -> Test.Cleveland.Michelson.*
  • Michelson.Doc.Test -> Test.Cleveland.Doc.Michelson, Test.Cleveland.Doc.Common
  • Morley.Nettest.Tasty -> Test.Cleveland.Tasty, Test.Cleveland.Tasty.Internal
  • Morley.Nettest.Tasty.* -> Test.Cleveland.Tasty.Internal.*

Michelson.Doc.Test is split into two modules: general utilities go to Test.Cleveland.Doc.Common, and Michelson-specific predicates to Test.Cleveland.Doc.Michelson (which also re-exports ...Common)

Lorentz.Test.Doc re-exports Test.Cleveland.Doc.Common, while previously it exported Michelson.Doc.Test

A new module Test.Cleveland.Doc is re-exporting both ...Lorentz and ...Michelson, and it can be used as a drop-in replacement for Lorentz.Test.Doc (but in most cases, Test.Cleveland.Doc.Lorentz can be used)

Additional rationale for renaming Doc modules: since we're planning to eventually deprecate and later remove Test.Cleveland.{Lorentz,Michelson}.{Integrational,Unit,Dummy} modules, but not Doc modules, it makes sense (to me at least) to move those out of the way, given the opportunity.

Morley.Nettest.Instances is used directly quite a bit, so it's considered a part of the interface and not moved into Internal.

Morley.Nettest.Util is merged into Test.Cleveland.Util

Morley.Nettest.Tasty is moved to Test.Cleveland.Tasty.Internal, and Test.Cleveland.Tasty is added, re-exporting the public interface from Test.Cleveland.Tasty.Internal. Test.Cleveland.Tasty.Internal is referenced directly only in the cleveland internal test-suite.

Additionally, --nettest- prefix in option names is replaced by --cleveland-

Modules in code/cleveland/test are also reshuffled a bit to reflect the new lib structure, namely:

  • Test.Morley.Nettest.Tasty.ReportExamples -> TestSuite.Cleveland.Tasty.Report.Examples
  • Test.Morley.Nettest.Tasty.Report -> TestSuite.Cleveland.Tasty.Report
  • Test.Morley.Nettest.Tasty -> TestSuite.Cleveland.Tasty
  • Test.Cleveland.Util -> TestSuite.Cleveland.Util

TestSuite prefix is used to avoid namespace conflict; prefix like Test.Test seemed silly.

Discussion points

  • I've also updated examples to use new module names, but those end up in a bit of a limbo: since snapshot.yaml references old versions of packages, examples end up being broken with the new module names, and I'm not sure whether it's a good idea to depend on git versions in examples.

    Okay, so examples are apparently tested, which makes updating them in this PR unnecessarily convoluted. Should track these separately, and update with another PR.

  • To avoid massive breakage, it may be a good idea to add compatibility modules with the old naming scheme (simply re-exporting the new modules as needed). We can mark those as deprecated with a described migration strategy.

  • Some functions exported from Test.Cleveland have nettest prefix, which is not necessarily descriptive, and in some cases (like nettestScenarioOnEmulator) may even be confusing. Do we want to replace this with cleveland? It would be more consistent, but will lead to more breakage downstream.

Related issue(s)

Resolves #410 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)
    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.

N/A, this is a refactor.

  • Documentation
    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

N/A, cleveland is unreleased

Stylistic guide (mandatory)

Edited by Nikolay Yakimov

Merge request reports