Skip to content

Commit c55aed2

Browse files
vaindclaude
andcommitted
test: improve test cases to use single expected multiline strings
Refactored git commit fallback test cases to follow the same pattern as 'supports cross-repo links' test using single expected multiline strings instead of multiple Should-Match assertions. Changes: - 'falls back to git commits when no changelog files exist': Now uses exact expected output - 'git commit fallback handles PR references correctly': Uses exact expected output - 'git commit fallback filters out version tag commits': Uses exact expected output with full commit list Benefits: - More consistent test style across the test suite - Easier to see what the expected output should be - Better failure messages when tests fail - All 16 tests continue to pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent edc6e45 commit c55aed2

File tree

1 file changed

+56
-24
lines changed

1 file changed

+56
-24
lines changed

updater/tests/get-changelog.Tests.ps1

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -264,30 +264,44 @@ Features, fixes and improvements in this release have been contributed by:
264264
$actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" `
265265
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.1' -NewTag 'v3.10.0'
266266

267-
# Verify structure rather than exact content to reduce external dependency brittleness
268-
$actual | Should -Match "## Changelog"
269-
$actual | Should -Match "### Commits between v3.9.1 and v3.10.0"
267+
$expected = @'
268+
## Changelog
270269
271-
# Should contain some expected commits (these are stable between these specific tags)
272-
$actual | Should -Match "- Forbid deducing reference types for m_predicate in FilterGenerator"
273-
$actual | Should -Match "- Make message macros.*thread safe"
270+
### Commits between v3.9.1 and v3.10.0
274271
275-
# Verify proper link formatting and sanitization
276-
$actual | Should -Match "github-redirect\.dependabot\.com"
277-
$actual | Should -Not -Match "@\w+"
272+
- Forbid deducing reference types for m_predicate in FilterGenerator ([#3005](https://github-redirect.dependabot.com/catchorg/Catch2/issues/3005))
273+
- Make message macros (FAIL, WARN, INFO, etc) thread safe
274+
- Improve performance of writing XML
275+
- Improve performance of writing JSON values
276+
- Don't add / to start of pkg-config file path when DESTDIR is unset
277+
- Fix color mode detection on FreeBSD by adding platform macro
278+
- Handle DESTDIR env var when generating pkgconfig files
279+
'@
280+
281+
$actual | Should -Be $expected
278282
}
279283

280284
It 'git commit fallback handles PR references correctly' {
281285
# Test with a known repository and tags that contain PR references
282286
$actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" `
283287
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.1' -NewTag 'v3.10.0'
284288

285-
# Check that PR references are converted to links with github-redirect (if any exist)
286-
if ($actual -match '#(\d+)') {
287-
$actual | Should -Match '\[#\d+\]\(https://github-redirect\.dependabot\.com/catchorg/Catch2/issues/\d+\)'
288-
}
289-
# Should not contain raw @mentions
290-
$actual | Should -Not -Match "@\w+"
289+
# This test verifies the same content as the main test, but focuses on PR link formatting
290+
$expected = @'
291+
## Changelog
292+
293+
### Commits between v3.9.1 and v3.10.0
294+
295+
- Forbid deducing reference types for m_predicate in FilterGenerator ([#3005](https://github-redirect.dependabot.com/catchorg/Catch2/issues/3005))
296+
- Make message macros (FAIL, WARN, INFO, etc) thread safe
297+
- Improve performance of writing XML
298+
- Improve performance of writing JSON values
299+
- Don't add / to start of pkg-config file path when DESTDIR is unset
300+
- Fix color mode detection on FreeBSD by adding platform macro
301+
- Handle DESTDIR env var when generating pkgconfig files
302+
'@
303+
304+
$actual | Should -Be $expected
291305
}
292306

293307
It 'git commit fallback returns empty when no commits found' {
@@ -303,15 +317,33 @@ Features, fixes and improvements in this release have been contributed by:
303317
$actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" `
304318
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.0' -NewTag 'v3.10.0'
305319

306-
# Should not contain version tag lines (v3.9.1 and v3.10.0 are version tags in this range)
307-
$actual | Should -Not -Match "- v3\.9\.1"
308-
$actual | Should -Not -Match "- v3\.10\.0"
309-
$actual | Should -Not -Match "- 3\.9\.1"
310-
$actual | Should -Not -Match "- 3\.10\.0"
311-
# But should contain meaningful commits if any exist
312-
if ($actual) {
313-
$actual | Should -Match "- \w+" # Should have some commit lines
314-
}
320+
# Expected output should not contain version tag commits but should have meaningful commits
321+
# This range includes v3.9.1 and v3.10.0 version commits that should be filtered out
322+
$expected = @'
323+
## Changelog
324+
325+
### Commits between v3.9.0 and v3.10.0
326+
327+
- Forbid deducing reference types for m_predicate in FilterGenerator ([#3005](https://github-redirect.dependabot.com/catchorg/Catch2/issues/3005))
328+
- Make message macros (FAIL, WARN, INFO, etc) thread safe
329+
- Improve performance of writing XML
330+
- Improve performance of writing JSON values
331+
- Don't add / to start of pkg-config file path when DESTDIR is unset
332+
- Fix color mode detection on FreeBSD by adding platform macro
333+
- Handle DESTDIR env var when generating pkgconfig files
334+
- Add tests for comparing & stringifying volatile pointers
335+
- Refactor CATCH_TRAP selection logic to prefer compiler-specific impls
336+
- Update generators.md
337+
- Cleanup WIP changes from last commit
338+
- Catch exceptions from StringMakers inside Detail::stringify
339+
- Fix StringMaker for time_point<system_clock> with non-default duration
340+
- Fix warning in `catch_unique_ptr::bool()`
341+
- Add enum types to what is captured by value by default
342+
- Don't follow __assume(false) with std::terminate in NDEBUG builds
343+
- Fix bad error reporting for nested exceptions in default configuration
344+
'@
345+
346+
$actual | Should -Be $expected
315347
}
316348

317349
It 'git commit fallback handles invalid repository gracefully' {

0 commit comments

Comments
 (0)