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

test-suite options don't work in common stanzas #8429

Closed
oberblastmeister opened this issue Aug 24, 2022 · 4 comments
Closed

test-suite options don't work in common stanzas #8429

oberblastmeister opened this issue Aug 24, 2022 · 4 comments
Labels
Cabal: common stanza Concerning `common` stanzas in `.cabal` files resolution: duplicate

Comments

@oberblastmeister
Copy link

Describe the bug
test-suite options used in common stanzas fail with an unknown field error. In the test-suite stanza the required fields are missing, even if they are provided by import.

To Reproduce
clone https://github.com/oberblastmeister/cabal-testing.

$ cabal v2-build
cabal output
Errors encountered when parsing cabal file ./cabal-testing.cabal:

cabal-testing.cabal:14:1: error:
Test suite "tests" is missing required field "main-is" or the field is not present in all conditional branches.

   12 |   main-is: Test.hs
   13 |
   14 | test-suite tests
      | ^

cabal-testing.cabal:11:3: warning:
Unknown field: "type"

   10 | common common-test
   11 |   type: exitcode-stdio-1.0
      |   ^

cabal-testing.cabal:12:3: warning:
Unknown field: "main-is"

   11 |   type: exitcode-stdio-1.0
   12 |   main-is: Test.hs
      |   ^

Expected behavior
Cabal should not error when using test-suite options in common stanzas. Cabal should recognize that the required options are provided by through import.

System information

  • NixOS 22.05
  • Cabal 3.8.1.0
  • GHC 9.2.4
@oberblastmeister oberblastmeister changed the title test suite options don't work in common stanzas test-suite options don't work in common stanzas Aug 24, 2022
@Mikolaj
Copy link
Member

Mikolaj commented Aug 24, 2022

What should the behaviour be when the options are imported in a non-test? Is there any explanation in the manual or code comments or PR or issue why only options common to all stanzas had been made permissible under common?

@ulysses4ever ulysses4ever added the Cabal: common stanza Concerning `common` stanzas in `.cabal` files label Aug 24, 2022
@ulysses4ever
Copy link
Collaborator

Dup of #6117

@fgaz
Copy link
Member

fgaz commented Aug 24, 2022

fyi type is optional from cabal-version: 3.8, so if you set that you can just leave it out
https://cabal.readthedocs.io/en/3.8/file-format-changelog.html#cabal-version-3-8

@oberblastmeister
Copy link
Author

Closing as this is a duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cabal: common stanza Concerning `common` stanzas in `.cabal` files resolution: duplicate
Projects
None yet
Development

No branches or pull requests

4 participants