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

Make ErrorSpec take a (NonEmpty String) rather than [String] #4473

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

TimSheard
Copy link
Contributor

All too often, when running a test, the test fails, and the explanation of the failure is the empty list ([]) of explanations.
Try as hard as I could, I could never trackdown where this list was coming from.

One of the design goals of the constrained generators was that failures should be explained.
So under the better design goal, that every failure should have a non-empty explanation, I have changed the
type of ErrorSpec from
ErrorSpec :: [String] -> Specification fn a
ErrorSpec :: Data.List.NonEmpty String -> Specification fn a

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

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

It looks like in base for 8.10.7 there is no singleton and append exported from Data.List.NonEmpty , so I think you might need to replace these with the constructor :| and <>, respectively, on order to make the PR compile for 8.10.7.

Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

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

Looks good to me but I think you need to change the singleton and append from NonEmpty in order to be able to merge it.

@TimSheard TimSheard force-pushed the ts-NonEmpty-ErrorSpec branch 2 times, most recently from 6cee0b3 to 7127dd0 Compare July 9, 2024 00:40
@TimSheard TimSheard force-pushed the ts-NonEmpty-ErrorSpec branch 2 times, most recently from 7b4f4a4 to e497b4f Compare July 10, 2024 10:30
AssertExplain, FalseSpec and other Pred modifers do too.
@lehins lehins enabled auto-merge July 10, 2024 14:59
@lehins lehins merged commit 3c16ca2 into master Jul 10, 2024
124 of 125 checks passed
@lehins lehins deleted the ts-NonEmpty-ErrorSpec branch July 10, 2024 19:19
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