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

cabal check testuite: add sanity checks #8248

Merged
merged 22 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
73e655a
(cabal check) Add "No 'name' field." test
ffaf1 Jun 22, 2022
e4fb931
(cabal check) Add "No 'version' field." test
ffaf1 Jun 22, 2022
55beba2
(cabal check) Add "No body" test
ffaf1 Jun 22, 2022
464ea04
(cabal check) Add "No duplicate names" test
ffaf1 Jun 22, 2022
b93f3b6
(cabal check) Add "OK duplicate exes names" test
ffaf1 Jun 22, 2022
caf2da1
(cabal check) Add "No internal name clash" test
ffaf1 Jun 22, 2022
4a95843
(cabal check) Add "No exposed modules" test
ffaf1 Jun 22, 2022
3106fae
(cabal check) Add "Version signatures" test
ffaf1 Jun 22, 2022
35fcb0e
(cabal check) Add "Autogen modules" test
ffaf1 Jun 22, 2022
395f94d
(cabal check) Add "Autogen include" test
ffaf1 Jun 22, 2022
27384d3
(cabal check) Add "No `main-is`" test
ffaf1 Jun 22, 2022
43f615b
(cabal check) Add "Malformed `main-is`" test
ffaf1 Jun 22, 2022
80b10b8
(cabal check) Add "`main-is` C obj" test
ffaf1 Jun 22, 2022
04d418c
(cabal check) Add "Autogen include" test for exes
ffaf1 Jun 22, 2022
65b4d2b
(cabal check) Add "Autogen modules" test for exes
ffaf1 Jun 22, 2022
2ce5531
(cabal check) Add "Malformed `main-is`" test (ts)
ffaf1 Jun 22, 2022
9e862dc
(cabal check) Add "`main-is` C obj" test (ts)
ffaf1 Jun 22, 2022
db5dfe5
(cabal check) Add "Autogen include" test for ts
ffaf1 Jun 22, 2022
cf21e5c
(cabal check) Add "Autogen modules" test for ts
ffaf1 Jun 22, 2022
603092e
(cabal check) Add "Malformed `main-is`" test (bm)
ffaf1 Jun 22, 2022
318fb29
(cabal check) Add "Autogen modules" test for bm
ffaf1 Jun 22, 2022
156fb34
(cabal check) Add "Autogen include" test for bm
ffaf1 Jun 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: An 'autogen-module' is neither on 'exposed-modules' or 'other-modules'.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-modules` have to appear in `other-modules` or
-- `exposed-modules`.
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

library
exposed-modules: Foo
default-language: Haskell2010
autogen-modules: AutoGenMod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: On benchmark 'benchmark' an 'autogen-module' is not on 'other-modules'
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-modules` have to appear in `other-modules` or
-- `exposed-modules` (benchmark).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

benchmark benchmark
main-is: Main.hs
default-language: Haskell2010
autogen-modules: AutoGenMod
type: exitcode-stdio-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: On executable 'exe' an 'autogen-module' is not on 'other-modules'
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-modules` have to appear in `other-modules` or
-- `exposed-modules` (executables).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

executable exe
main-is: Main.hs
default-language: Haskell2010
autogen-modules: AutoGenMod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: On test suite 'test' an 'autogen-module' is not on 'other-modules'
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-modules` have to appear in `other-modules` or
-- `exposed-modules` (testsuite).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0
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
default-language: Haskell2010
autogen-modules: AutoGenMod
type: exitcode-stdio-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: An include in 'autogen-includes' is neither in 'includes' or 'install-includes'.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-includes` should appear in `install-includes` or
-- `includes`.
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

library
exposed-modules: Foo
default-language: Haskell2010
autogen-includes: AutoGenInc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: An include in 'autogen-includes' is not in 'includes'.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-includes` should appear in `install-includes` or
-- `includes` (benchmark).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

benchmark benchmark
main-is: Main.hs
autogen-includes: AutoGenInc
default-language: Haskell2010
type: exitcode-stdio-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: An include in 'autogen-includes' is not in 'includes'.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-includes` should appear in `install-includes` or
-- `includes` (executable).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

executable exe
main-is: Main.hs
autogen-includes: AutoGenInc
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: An include in 'autogen-includes' is not in 'includes'.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- All `autogen-includes` should appear in `install-includes` or
-- `includes` (testsuite).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0
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
autogen-includes: AutoGenInc
default-language: Haskell2010
type: exitcode-stdio-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The following errors will cause portability problems on other environments:
Warning: The package uses a C/C++/obj-C source file for the 'main-is' field. To use this feature you need to specify 'cabal-version: 1.18' or higher.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- You need `cabal-version` ≥ 1.18 to use C/C++/obj-C source files
-- in `main-is`.
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cabal-version: 1.12
build-type: Custom
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3
license-file: LICENSE

custom-setup

executable exe
main-is: main.c
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The following errors will cause portability problems on other environments:
Warning: The package uses a C/C++/obj-C source file for the 'main-is' field. To use this feature you need to specify 'cabal-version: 1.18' or higher.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- You need `cabal-version` ≥ 1.18 to use C/C++/obj-C source files
-- in `main-is`. (testsuite)
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cabal-version: 1.12
build-type: Custom
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3
license-file: LICENSE

custom-setup

test-suite test
main-is: main.c
default-language: Haskell2010
type: exitcode-stdio-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: The 'main-is' field must specify a '.hs' or '.lhs' file (even if it is generated by a preprocessor), or it may specify a C/C++/obj-C source file.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- `main-is` has to be a `.hs` or `.lhs` file (or C* source file).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

executable exe
main-is: Main
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: The 'main-is' field must specify a '.hs' or '.lhs' file (even if it is generated by a preprocessor).
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- `main-is` has to be a `.hs` or `.lhs` file (or C* source file) (benchmark).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

benchmark benchmark
Main-is: Main
type: exitcode-stdio-1.0
default-language: Haskell2010

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: The 'main-is' field must specify a '.hs' or '.lhs' file (even if it is generated by a preprocessor), or it may specify a C/C++/obj-C source file.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- `main-is` has to be a `.hs` or `.lhs` file (or C* source file) (testsuite).
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0
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
type: exitcode-stdio-1.0
default-language: Haskell2010

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: No executables, libraries, tests, or benchmarks found. Nothing to do.
Warning: These warnings may cause trouble when distributing the package:
Warning: pkg.cabal:0:0: A package using 'cabal-version: 2.2' must use section syntax. See the Cabal user guide for details.
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- No exec, library, test or benchmark.
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cabal-version: 2.2
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cabal check
Warning: The package will not build sanely due to these errors:
Warning: Duplicate sections: dup. The name of every library, executable, test suite, and benchmark section in the package must be unique.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- Duplicate section names.
main = cabalTest $
fails $ cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cabal-version: 2.2
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: none@example.com
license: GPL-3.0-or-later

library dup
exposed-modules: Foo
default-language: Haskell2010

test-suite dup
main-is: Main.hs
type: exitcode-stdio-1.0
default-language: Haskell2010
Loading