Skip to content

Commit 2954583

Browse files
author
Kapil Borle
committed
Test each line individually instead of the entire text
This should fix the appveyor test failures caused by inconsistency between expected and actual line endings.
1 parent 0ace603 commit 2954583

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Tests/Rules/ProvideCommentHelp.tests.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@ function Test-Correction {
3232

3333
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $scriptDef -Settings $settings
3434
$violations.Count | Should Be 1
35-
$violations[0].SuggestedCorrections[0].Text | Should Be $expectedCorrection
35+
36+
# We split the lines because appveyor checks out files with "\n" endings
37+
# on windows, which results in inconsistent line endings between corrections
38+
# and result.
39+
$resultLines = $violations[0].SuggestedCorrections[0].Text -split "\r?\n"
40+
$expectedLines = $expectedCorrection -split "\r?\n"
41+
$resultLines.Count | Should Be $expectedLines.Count
42+
for ($i = 0; $i -lt $resultLines.Count; $i++) {
43+
$resultLine = $resultLines[$i]
44+
$expectedLine = $expectedLines[$i]
45+
$resultLine | Should Be $expectedLine
46+
}
3647
}
3748

3849
Describe "ProvideCommentHelp" {

0 commit comments

Comments
 (0)