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

Wrong parse error when main-is missing from test-suite #8246

Open
ffaf1 opened this issue Jun 22, 2022 · 2 comments
Open

Wrong parse error when main-is missing from test-suite #8246

ffaf1 opened this issue Jun 22, 2022 · 2 comments

Comments

@ffaf1
Copy link
Collaborator

ffaf1 commented Jun 22, 2022

Describe the bug
In a file with a missing main-is in test-suite, parser incorrectly complains about wrong or missing type

To Reproduce

name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

test-suite test
    -- main-is: Main.hs
    type:    exitcode-stdio-1.0
    default-language: Haskell2010
Warning: pkg.cabal:10:1: Test suite "test" is missing required field "type" or
the field is not present in all conditional branches. The available test types
are: exitcode-stdio-1.0, detailed-0.9
Warning: pkg.cabal:10:1: The 'main-is' field is required for the
exitcode-stdio-1.0 test suite type.
Errors encountered when parsing cabal file ./pkg.cabal:

pkg.cabal:10:1: error:
Test suite "test" is missing required field "type" or the field is not present in all conditional branches. The available test types are: exitcode-stdio-1.0, detailed-0.9

    8 | license: GPL-3.0-or-later
    9 |
   10 | test-suite test
      | ^

pkg.cabal:10:1: error:
The 'main-is' field is required for the exitcode-stdio-1.0 test suite type.

    8 | license: GPL-3.0-or-later
    9 |
   10 | test-suite test
      | ^
Error: cabal: parse error

Expected behavior
Complain about the right stuff (main-is missing) or leave it to cabal check, etc.

System information

  • debian linux
  • cabal-install 3.9 HEAD
@ffaf1
Copy link
Collaborator Author

ffaf1 commented Jun 22, 2022

Same goes for benchmark stanza.

@andreasabel
Copy link
Member

The parser is a mess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants