UnkindPartition / tasty

Modern and extensible testing framework for Haskell
640 stars 110 forks source link

Support GHC 9.2 #317

Closed fabianhjr closed 3 years ago

fabianhjr commented 3 years ago

Tested locally on NixOS x86_64 using the following change on stack.yaml:

-resolver: nightly-2021-08-22
+resolver: nightly-2021-11-15
+compiler: ghc-9.2.1
 packages:
 - core/

Result (abbreviated):

> stack exec tasty-core-tests                                                                                                                                                                                     Wed 17 Nov 2021 10:03:05 PM CST
Stack has not been tested with GHC versions above 9.0, and using 9.2.1, this may fail
Stack has not been tested with Cabal versions above 3.4, but version 3.6.0.0 was found, this may fail
Tests
  Resources
    Normal; a test excluded by a pattern:                           OK (0.10s)
    Exception during resource initialization:                       OK
    Exception in test body; resource is released:                   OK
    Exception in finalizer:                                         OK
    Order of finalizers when the test suite runs:                   OK (0.20s)
    Order of finalizers when the test suite is aborted (1 thread):  OK (0.04s)
    Order of finalizers when the test suite is aborted (2 threads): OK (0.04s)
[..]
    parseprinted:                                                   OK (0.03s)
      +++ OK, passed 100 tests.
  OptionMessages
    JankyOption generates warning messages:                         OK
      WARNING (in the IsOption instance for JankyOption):
      optionCLParser defines multiple options. Consider only defining
      a single option here, as defining multiple options does not play
      well with how tasty displays default values.

      WARNING (in the IsOption instance for JankyOption):
      Using default values (e.g., with Options.Applicative.value) in
      optionCLParser is prohibited, as it interferes with tasty's ability
      to read environment variable options properly. Moreover, assigning
      default values is unnecessary, as their functionality is subsumed
      by the defaultValue method of IsOption.

All 112 tests passed (11.34s)

Doing a cabal build all also completed successfully. :3

UnkindPartition commented 3 years ago

Thank you for the patch. What happened to Semigroup/Monoid in that version? Strangely, the changelog for base doesn't say anything about that.

fabianhjr commented 3 years ago

It was promoted to a warn pointing to this doc: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid

Example:

Test/Tasty/Options.hs:103:3: warning: [-Wnoncanonical-monoid-instances]
    Noncanonical ‘mappend’ definition detected
    in the instance declaration for ‘Monoid OptionSet’.
    ‘mappend’ will eventually be removed in favour of ‘(<>)’
    Either remove definition for ‘mappend’ (recommended) or define as ‘mappend = (<>)’
    See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid
    |
103 |   OptionSet a `mappend` OptionSet b =
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
fabianhjr commented 3 years ago

Split into two commits.

UnkindPartition commented 3 years ago

Got it, thanks. It seems to me though that too much code is inside CPP ifs right now. Could you refactor it so that only mappend's definition is conditional, like in that wiki page? This should make the code easier to understand and modify if needed.

fabianhjr commented 3 years ago

Done, there are 3 new warnings that only appear on 9.2 and all current (8.0 - 9.0) pass with no new warnings.

https://github.com/LibreCybernetics/tasty/actions/runs/1481646589

UnkindPartition commented 3 years ago

Merged, thank you!