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

Doctest, cannot set package flags with :seti; use :set #89

Open
philderbeast opened this issue Aug 9, 2021 · 3 comments
Open

Doctest, cannot set package flags with :seti; use :set #89

philderbeast opened this issue Aug 9, 2021 · 3 comments

Comments

@philderbeast
Copy link
Collaborator

I'm building with stack against ghc-9.0.1 and noticed this error called out for stack test uom-plugin-tutorial:doctest but not for cabal test uom-plugin-tutorial:doctest --project-file=901.cabal.project regarding the following line:

-- >>> :seti -fplugin Data.UnitsOfMeasure.Plugin -XDataKinds -XQuasiQuotes -XTypeOperators

> stack test uom-plugin-tutorial:doctest
uom-plugin-tutorial> test (suite: doctest)

./doc/Data/UnitsOfMeasure/Tutorial.hs:80: failure in expression
`:seti -fplugin Data.UnitsOfMeasure.Plugin -XDataKinds -XQuasiQuotes -XTypeOperators'
expected:
 but got: cannot set package flags with :seti; use :set
          ^

./doc/Data/UnitsOfMeasure/Tutorial.hs:151: failure in expression
`:seti -XPartialTypeSignatures -fno-warn-partial-type-signatures'
expected:
 but got: cannot set package flags with :seti; use :set
          ^

Examples: 64  Tried: 54  Errors: 0  Failures: 2

uom-plugin-tutorial> Test suite doctest failed
Test suite failure for package uom-plugin-tutorial-0.3.0.1
    doctest:  exited with: ExitFailure 1
> cabal test uom-plugin:doctest --project-file=901.cabal.project
Build profile: -w ghc-9.0.1 -O0
In order, the following will be built (use -v for more details):
 - uom-plugin-0.4.0.0 (test:doctest) (ephemeral targets)
Preprocessing test suite 'doctest' for uom-plugin-0.4.0.0..
Building test suite 'doctest' for uom-plugin-0.4.0.0..
Running 1 test suites...
Test suite doctest: RUNNING...
Test suite doctest: PASS
Test suite logged to:
/.../ghc-9.0.1/uom-plugin-0.4.0.0/t/doctest/noopt/test/uom-plugin-0.4.0.0-doctest.log
1 of 1 test suites (1 of 1 test cases) passed.

From the ghc-9.2 branch, this change to stack.yaml reproduces the problem:

-    resolver: lts-11.22
+    resolver: nightly-2021-08-08
     packages:
     - build
     - uom-plugin
     - uom-plugin-tutorial
     - uom-plugin-examples
     extra-deps:
-    - units-parser-0.1.0.0
+    - units-parser-0.1.1.4
@philderbeast
Copy link
Collaborator Author

I made a mistake in the initial report:

- > cabal test uom-plugin:doctest --project-file=901.cabal.project
+ > cabal test uom-plugin-tutorial:doctest --project-file=901.cabal.project

With that change, cabal fails too but for a different reason:

> cabal test uom-plugin-tutorial:doctest --project-file=901.cabal.project
Build profile: -w ghc-9.0.1 -O0
In order, the following will be built (use -v for more details):
 - uom-plugin-tutorial-0.3.0.1 (test:doctest) (ephemeral targets)
Preprocessing test suite 'doctest' for uom-plugin-tutorial-0.3.0.1..
Building test suite 'doctest' for uom-plugin-tutorial-0.3.0.1..
Running 1 test suites...
Test suite doctest: RUNNING...

doc/Data/UnitsOfMeasure/Tutorial.hs:50:1: error:
    Could not load module ‘Data.UnitsOfMeasure’
    It is a member of the hidden package ‘uom-plugin-0.4.0.0’.
    You can run ‘:set -package uom-plugin’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
50 | import Data.UnitsOfMeasure
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Test suite doctest: FAIL
Test suite logged to:
/.../ghc-9.0.1/uom-plugin-tutorial-0.3.0.1/t/doctest/noopt/test/uom-plugin-tutorial-0.3.0.1-doctest.log
0 of 1 test suites (0 of 1 test cases) passed.
cabal: Tests failed for test:doctest from uom-plugin-tutorial-0.3.0.1.

@philderbeast
Copy link
Collaborator Author

philderbeast commented Aug 9, 2021

@adamgundry I got this to compile for the stack build with #90 by changing seti to set. As this is for the tutorial and in GHCI seti is the way to go, perhaps we could use set for the doctest while showing seti in the haddocks?

I think we could do this using an unreferenced chunk?

@philderbeast
Copy link
Collaborator Author

With regard the cabal test failure, adding -package uom-plugin to the doctest setup worked but I stashed that change, blew away the dist-newstyle folder and tried again and found the failure with cabal test to be not reproducible.

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

1 participant