Skip to content

Commit

Permalink
Improve assertions in IntegrationTests2 testConfigOptionComments
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
9999years authored and Mikolaj committed Oct 1, 2024
1 parent 97ebb32 commit 0269d6c
Showing 1 changed file with 262 additions and 218 deletions.
Loading

0 comments on commit 0269d6c

Please # to comment.