Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add golden tests for CLI help #5206

Merged
merged 1 commit into from
May 19, 2023
Merged

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented May 9, 2023

Description

Add golden tests for CLI help. This will help ensure our help text gets reviewed and the formatting is correct.

Depends on #5200

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Runnings tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-8.10.7 and ghc-9.2.7
  • Self-reviewed the diff

Note on CI

If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.

@newhoggy newhoggy marked this pull request as ready for review May 9, 2023 04:35
@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch from 9579c24 to 118fc2e Compare May 9, 2023 04:36
@newhoggy newhoggy requested a review from carbolymer May 9, 2023 04:43
@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch from 118fc2e to 7d095a9 Compare May 9, 2023 04:59
@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch 7 times, most recently from 3935720 to e244c5c Compare May 10, 2023 11:11
@newhoggy newhoggy requested review from a team, deepfire, mgmeier and fmaste as code owners May 10, 2023 11:11
cardano-node/test/Test/Cardano/Node/FilePermissions.hs Outdated Show resolved Hide resolved
@@ -174,6 +174,17 @@ executable cardano-cli
, optparse-applicative-fork
, transformers-except

library test-lib
import: project-config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch from e244c5c to 07a005f Compare May 17, 2023 05:18
@newhoggy newhoggy requested a review from Jimbo4350 May 17, 2023 07:05
@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch from 170a00c to 95ac429 Compare May 17, 2023 07:06
@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch 2 times, most recently from 7ecd49c to 40e60a2 Compare May 17, 2023 07:50
@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch from d610f7e to e558d93 Compare May 18, 2023 06:04
, Diff
, directory
, filepath
, hedgehog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated hedgehog

@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch 4 times, most recently from 140f533 to d148bf2 Compare May 19, 2023 14:02
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

]

let lines = Text.lines $ Text.pack help
let usages = List.filter (not . null) $ extractCmd . Text.drop 19 <$> List.filter (Text.isPrefixOf "Usage: cardano-cli ") lines
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text.drop 19 removes "Usage: cardano-cli "? Adding a comment saying this would be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've introduced a new function which returns the magic number 19.

@newhoggy newhoggy force-pushed the newhoggy/add-golden-test-for-cli-help branch from d148bf2 to 02f3d07 Compare May 19, 2023 15:08
@newhoggy newhoggy enabled auto-merge May 19, 2023 15:25
@newhoggy newhoggy added this pull request to the merge queue May 19, 2023
Merged via the queue into master with commit a70090a May 19, 2023
@iohk-bors iohk-bors bot deleted the newhoggy/add-golden-test-for-cli-help branch May 19, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants