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

Improve assertion messages in IntegrationTests2 testConfigOptionComments #10314

Conversation

9999years
Copy link
Collaborator

Before, failing asserts in this test would look like this:

Writing default configuration to
/Users/wiggles/cabal/cabal-install/tests/IntegrationTests2/config/cabal-config/config
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2024-09-04T15:12:07Z.
Integration tests (internal)
  Flag tests
    Test Config options for commented options: FAIL
      tests/IntegrationTests2.hs:2015:
      expected: "  urll"
       but got: "  url"

The output includes a message that a configuration file has been written, but that's not the configuration file under test! The actual configuration file being tested is
cabal-install/tests/IntegrationTests2/config/default-config, which shows up nowhere in the output.

Now, the messages include the setting name being searched for and the path of the relevant configuration file:

Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2024-09-04T22:53:05Z.
Integration tests (internal)
  Flag tests
    Test Config options for commented options: FAIL
      tests/IntegrationTests2.hs:2015:
      Did not find expected line for setting "url" in configuration file /Users/wiggles/cabal/cabal-install/tests/IntegrationTests2/config/default-config
      expected: "  urll"
       but got: "  url"

The Writing default configuration to... message with the misleading path has also been silenced.

@9999years 9999years added the merge me Tell Mergify Bot to merge label Sep 5, 2024
@mergify mergify bot added merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days ready and waiting Mergify is waiting out the cooldown period labels Oct 1, 2024
Before, failing asserts in this test would look like this:

```
Writing default configuration to
/Users/wiggles/cabal/cabal-install/tests/IntegrationTests2/config/cabal-config/config
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2024-09-04T15:12:07Z.
Integration tests (internal)
  Flag tests
    Test Config options for commented options: FAIL
      tests/IntegrationTests2.hs:2015:
      expected: "  urll"
       but got: "  url"
```

The output includes a message that a configuration file has been
written, but that's not the configuration file under test! The actual
configuration file being tested is
`cabal-install/tests/IntegrationTests2/config/default-config`, which
shows up nowhere in the output.

Now, the messages include the setting name being searched for and the
path of the relevant configuration file:

```
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2024-09-04T22:53:05Z.
Integration tests (internal)
  Flag tests
    Test Config options for commented options: FAIL
      tests/IntegrationTests2.hs:2015:
      Did not find expected line for setting "url" in configuration file /Users/wiggles/cabal/cabal-install/tests/IntegrationTests2/config/default-config
      expected: "  urll"
       but got: "  url"
```

The `Writing default configuration to...` message with the misleading
path has also been silenced.
@Mikolaj Mikolaj force-pushed the make-test-config-option-comments-asserts-clearer branch from 6236fb4 to 0269d6c Compare October 1, 2024 17:09
@mergify mergify bot merged commit db5628c into haskell:master Oct 1, 2024
48 checks passed
@9999years 9999years deleted the make-test-config-option-comments-asserts-clearer branch October 1, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge ready and waiting Mergify is waiting out the cooldown period
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants