Rename of DoesContain to Contains?
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I've noticed a small inconsistency in naming in `cabal-testsuite`. Could we make this change, using `Contains` universally as the opposite of `DoesNotContain` rather than `DoesContain` as the opposite?
```diff
- assertFileDoesContain :: MonadIO m => WithCallStack (FilePath -> String -> m ())
+ assertFileContains :: MonadIO m => WithCallStack (FilePath -> String -> m ())
```
The `assert.*Contain[s]*` functions:
```
$ grep -o 'assert.*DoesContain.*::' cabal-testsuite/src/Test/Cabal/Prelude.hs
assertFileDoesContain ::
$ grep -o 'assert.*Contains.*::' cabal-testsuite/src/Test/Cabal/Prelude.hs
assertOutputContains ::
assertAnyFileContains ::
assertNoFileContains ::
$ grep -o 'assert.*DoesNotContain.*::' cabal-testsuite/src/Test/Cabal/Prelude.hs
assertOutputDoesNotContain ::
assertFileDoesNotContain ::
```
Total hits, mostly uses:
```
$ grep -o 'assert.*DoesContain' ./cabal-testsuite/**/*.hs | wc -l
43
$ grep -o 'assert.*Contains' ./cabal-testsuite/**/*.hs | wc -l
275
$ grep -o 'assert.*DoesNotContain' ./cabal-testsuite/**/*.hs | wc -l
95
```
The `assert.*Match.*` functions are consistently named, using `Matches` and `DoesNotMatch` as suffix:
```
$ grep -Po 'assert.*Match.*::' cabal-testsuite/src/Test/Cabal/Prelude.hs
assertOutputMatches ::
assertOutputDoesNotMatch ::
assertGlobMatches ::
assertGlobDoesNotMatch ::
assertGlobMatchesTestDir ::
assertGlobDoesNotMatchTestDir ::
```
Contributor guide
Research direction
Start in cabal-testsuite/src/Test/Cabal/Prelude.hs, where the containment assertion declarations are listed, then grep cabal-testsuite/**/*.hs for all DoesContain uses. Rename assertFileDoesContain and its references to the Contains convention, and verify that no unintended DoesContain references remain while the existing DoesNotContain and other assertion names stay consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100