cabal
cabal copied to clipboard
Wrong parse error when `main-is` missing from `test-suite`
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: [email protected]
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
Same goes for benchmark stanza.
The parser is a mess.