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

how to define a conditional test suite ? #285

Closed
simonmichael opened this issue Mar 25, 2018 · 3 comments
Closed

how to define a conditional test suite ? #285

simonmichael opened this issue Mar 25, 2018 · 3 comments

Comments

@simonmichael
Copy link

I'd like to skip doctests for GHC 8.4, due to sol/doctest#199. I've tried:

tests:

  when:
  - condition: (!impl(ghc >= 8.4))
    doctests:
      main: doctests.hs
      source-dirs: tests
      dependencies:
      - doctest >=0.8
      - Glob >=0.7

  hunittests:
    ...

# "Error in $.tests.when: expected record (:*:), encountered Array"

and

tests:

  doctests:
    main: doctests.hs
    source-dirs: tests
    dependencies:
    - doctest >=0.8
    - Glob >=0.7
    when:
    - condition: (!impl(ghc >= 8.4))
      buildable: false

# doctests test suite still runs
@sol
Copy link
Owner

sol commented Mar 26, 2018

@simonmichael I would expect the second option to work. Can you provide your full package.yaml and the output of hpack --version or stack --version.

@sol
Copy link
Owner

sol commented Mar 26, 2018

@simonmichael Is your condition correct? Should that be impl(ghc >= 8.4) instead?

@simonmichael
Copy link
Author

You're right, and now it works. Thank you very much @sol. For the record, here's my working solution:

tests:

  doctests:
    main: doctests.hs
    source-dirs: tests
    dependencies:
    - doctest >=0.8
    - Glob >=0.7
    # doctest won't run with ghc 8.4 on mac right now, https://github.com/sol/hpack/issues/199
    when:
    - condition: impl(ghc >= 8.4) && os(darwin)
      buildable: false

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

No branches or pull requests

2 participants