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

Don't display error links #448

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Don't display error links #448

merged 1 commit into from
Jul 29, 2024

Conversation

hsyl20
Copy link
Contributor

@hsyl20 hsyl20 commented Jul 29, 2024

Fix #447

@sol
Copy link
Owner

sol commented Jul 29, 2024

Thanks @hsyl20.

If you want this on Hackage, then please open a separate PR that:

@sol sol enabled auto-merge (rebase) July 29, 2024 21:59
@sol sol disabled auto-merge July 29, 2024 22:00
@sol
Copy link
Owner

sol commented Jul 29, 2024

@hsyl20 I'm still puzzled why this is not picked up by any of our tests. Did you try to add a test for this?

@sol sol merged commit f930eaa into sol:main Jul 29, 2024
51 checks passed
@hsyl20
Copy link
Contributor Author

hsyl20 commented Jul 30, 2024

@sol I've just tried to run cabal test with GHC 9.10 and I get:

Failures:

  test/MainSpec.hs:128:7:
  1) Main, doctest as a runner for QuickCheck properties, runs a boolean property
       property-bool ["Foo.hs"]
       expected: Examples: 1  Tried: 1  Errors: 0  Failures: 0
        but got: Examples: 1  Tried: 1  Errors: 0  Failures: 1

  To rerun use: --match "/Main/doctest as a runner for QuickCheck properties/runs a boolean property/" --seed 1415118186

  test/MainSpec.hs:132:7:
  2) Main, doctest as a runner for QuickCheck properties, runs an explicitly quantified property
       property-quantified ["Foo.hs"]
       expected: Examples: 1  Tried: 1  Errors: 0  Failures: 0
        but got: Examples: 1  Tried: 1  Errors: 0  Failures: 1

  To rerun use: --match "/Main/doctest as a runner for QuickCheck properties/runs an explicitly quantified property/" --seed 1415118186

  test/MainSpec.hs:136:7:
  3) Main, doctest as a runner for QuickCheck properties, runs an implicitly quantified property
       property-implicitly-quantified ["Foo.hs"]
       expected: Examples: 1  Tried: 1  Errors: 0  Failures: 0
        but got: Examples: 1  Tried: 1  Errors: 0  Failures: 1

  To rerun use: --match "/Main/doctest as a runner for QuickCheck properties/runs an implicitly quantified property/" --seed 1415118186

  test/MainSpec.hs:144:7:
  4) Main, doctest as a runner for QuickCheck properties, runs a boolean property with an explicit type signature
       property-bool-with-type-signature ["Foo.hs"]
       expected: Examples: 1  Tried: 1  Errors: 0  Failures: 0
        but got: Examples: 1  Tried: 1  Errors: 0  Failures: 1

  To rerun use: --match "/Main/doctest as a runner for QuickCheck properties/runs a boolean property with an explicit type signature/" --seed 1415118186

  test/MainSpec.hs:148:7:
  5) Main, doctest as a runner for QuickCheck properties, runs $setup before each property
       property-setup ["Foo.hs"]
       expected: Examples: 3  Tried: 3  Errors: 0  Failures: 0
        but got: Examples: 3  Tried: 1  Errors: 0  Failures: 1

  To rerun use: --match "/Main/doctest as a runner for QuickCheck properties/runs $setup before each property/" --seed 1415118186

  test/PropertySpec.hs:24:32:
  6) Property.runProperty reports a failing property
       expected: Failure "*** Failed! Falsified (after 1 test):"
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/reports a failing property/" --seed 1415118186

  test/PropertySpec.hs:27:31:
  7) Property.runProperty runs a Bool property
       expected: Success
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/runs a Bool property/" --seed 1415118186

  test/PropertySpec.hs:30:39:
  8) Property.runProperty runs a Bool property with an explicit type signature
       expected: Success
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/runs a Bool property with an explicit type signature/" --seed 1415118186

  test/PropertySpec.hs:33:66:
  9) Property.runProperty runs an implicitly quantified property
       expected: Success
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/runs an implicitly quantified property/" --seed 1415118186

  test/PropertySpec.hs:39:64:
  10) Property.runProperty runs an implicitly quantified property even with GHC 7.4
       expected: Success
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/runs an implicitly quantified property even with GHC 7.4/" --seed 1415118186

  test/PropertySpec.hs:42:74:
  11) Property.runProperty runs an explicitly quantified property
       expected: Success
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/runs an explicitly quantified property/" --seed 1415118186

  test/PropertySpec.hs:45:48:
  12) Property.runProperty allows to mix implicit and explicit quantification
       expected: Success
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/allows to mix implicit and explicit quantification/" --seed 1415118186

  test/PropertySpec.hs:48:34:
  13) Property.runProperty reports the value for which a property fails
       expected: Failure "*** Failed! Falsified (after 1 test):\n0"
        but got: Failure "<interactive>:32:3: error: [GHC-88464]\n    Variable not in scope:\n      polyQuickCheck\n        :: Language.Haskell.TH.Syntax.Name\n           -> Language.Haskell.TH.Lib.Internal.ExpQ"

  To rerun use: --match "/Property/runProperty/reports the value for which a property fails/" --seed 1415118186

  test/PropertySpec.hs:52:75:
  14) Property.runProperty reports the values for which a property that takes multiple arguments fails
       expected: ["False", "0", "\"\""]
        but got: ["    Variable not in scope:", "      polyQuickCheck", "        :: Language.Haskell.TH.Syntax.Name", "           -> Language.Haskell.TH.Lib.Internal.ExpQ"]

  To rerun use: --match "/Property/runProperty/reports the values for which a property that takes multiple arguments fails/" --seed 1415118186

  test/RunSpec.hs:85:5:
  15) Run.doctest prints verbose description of a property
       uncaught exception: ExitCode
       ExitFailure 1

  To rerun use: --match "/Run/doctest/prints verbose description of a property/" --seed 1415118186

  test/RunSpec.hs:114:5:
  16) Run.doctest can deal with potentially problematic GHC options
       uncaught exception: ExitCode
       ExitFailure 1

  To rerun use: --match "/Run/doctest/can deal with potentially problematic GHC options/" --seed 1415118186

  test/RunSpec.hs:129:60:
  17) Run.doctestWithResult, on parse error, prints a useful error message
       expected: "Foo.hs:6:1: error: [GHC-58481]\n    parse error (possibly incorrect indentation or mismatched brackets)\n\n"
        but got: "Foo.hs:6:1: error: [\ESC]8;;https://errors.haskell.org/messages/GHC-58481\ESC\\GHC-58481\ESC]8;;\ESC\\]\n    parse error (possibly incorrect indentation or mismatched brackets)\n\n"

  To rerun use: --match "/Run/doctestWithResult/on parse error/prints a useful error message/" --seed 1415118186

Randomized with seed 1415118186

Finished in 10.0337 seconds
207 examples, 17 failures
Test suite spec: FAIL
Test suite logged to:
/home/hsyl20/projects/doctest/dist-newstyle/build/x86_64-linux/ghc-9.10.1/doctest-0.22.8/t/spec/test/doctest-0.22.8-spec.log
0 of 1 test suites (0 of 1 test cases) passed.
Error: [Cabal-7125]
Tests failed for test:spec from doctest-0.22.8.

With GHC 9.8 we get only 16 failures as the 17th one is due to error links. I don't understand why my change doesn't fix the test though :/

@hsyl20
Copy link
Contributor Author

hsyl20 commented Jul 30, 2024

Thanks @hsyl20.

If you want this on Hackage, then please open a separate PR that:

* updates [CHANGES.markdown](https://github.com/sol/doctest/blob/main/CHANGES.markdown)

* bumps the version in `package.yaml`

Done in #449

@sol
Copy link
Owner

sol commented Jul 31, 2024

With GHC 9.8 we get only 16 failures as the 17th one is due to error links. I don't understand why my change doesn't fix the test though :/

  1. On CI, with your changes reverted, all tests succeed. https://github.com/sol/doctest/actions/runs/10174599513/job/28140587910
    I'd like to understand what exactly is happening here before moving forward with a release.
  2. Locally, you need to run the tests with cabal exec $(cabal list-bin spec).

@hsyl20
Copy link
Contributor Author

hsyl20 commented Jul 31, 2024

Locally, you need to run the tests with cabal exec $(cabal list-bin spec).

With the right command line to run tests (I was using cabal test) I only get 1 failure with 9.10:

Failures:

  test/RunSpec.hs:129:60:
  1) Run.doctestWithResult, on parse error, prints a useful error message
       expected: "Foo.hs:6:1: error: [GHC-58481]\n    parse error (possibly incorrect indentation or mismatched brackets)\n\n"
        but got: "Foo.hs:6:1: error: [\ESC]8;;https://errors.haskell.org/messages/GHC-58481\ESC\\GHC-58481\ESC]8;;\ESC\\]\n    parse error (possibly incorrect indentation or mismatched brackets)\n\n"

The issue is that the -fprint-error-index-links=never flag isn't set when we print exceptions. I'll open a PR.

@hsyl20
Copy link
Contributor Author

hsyl20 commented Jul 31, 2024

I've pushed the fix in #449. Let's continue the discussion there.

@hsyl20 hsyl20 mentioned this pull request Jul 31, 2024
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

Successfully merging this pull request may close these issues.

Error index links should be hidden
2 participants