Improve assertions in `IntegrationTests2` `testConfigOptionComments`
commit0269d6c44bbb3c71424b9522d53ffb608cc9055a
authorRebecca Turner <rbt@sent.as>
Thu, 5 Sep 2024 01:21:47 +0000 (4 18:21 -0700)
committerMikolaj <281893+Mikolaj@users.noreply.github.com>
Tue, 1 Oct 2024 17:09:12 +0000 (1 17:09 +0000)
treec618aade49bb47f592fc83ed7eef65613e3d906c
parent97ebb32bbed87dde701ef9d496a77110217c7df5
Improve assertions in `IntegrationTests2` `testConfigOptionComments`

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.
cabal-install/tests/IntegrationTests2.hs