-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Normalize line endings before comparing string in tests #11499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,15 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adityapatwardhan, your last commit had 2 failures in Failed to complete request to "https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/". Response status code does not indicate success: 404 (Not Found).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 119
119: throw "Failed to complete request to `"$url`". $($_.Exception.Message)"
Verify Markdown Links.Verify links in /home/vsts/work/1/s/docs/debugging/README.md.https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/ should work Failed to complete request to "https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/". Response status code does not indicate success: 410 (Gone).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 119
119: throw "Failed to complete request to `"$url`". $($_.Exception.Message)"
|
||
| BeforeAll { | ||
| Register-DebuggerHandler | ||
|
|
||
| function NormalizeLineEnd | ||
| { | ||
| param ( | ||
| [string] $string | ||
| ) | ||
|
|
||
| $string -replace "`r`n", "`n" | ||
| } | ||
| } | ||
|
|
||
| AfterAll { | ||
|
|
@@ -76,6 +85,7 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
| 7: } | ||
| 8: | ||
| '@ | ||
| $testScriptList = NormalizeLineEnd -string $testScriptList | ||
|
|
||
| $results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'l','list') | ||
| $result = @{ | ||
|
|
@@ -99,7 +109,7 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
| } | ||
|
|
||
| It 'Should show the entire script listing with the current position on line 5' { | ||
| $result['l'] | Should -BeExactly $testScriptList | ||
| (NormalizeLineEnd -string $result['l']) | Should -BeExactly $testScriptList | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -122,6 +132,8 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
| 8: | ||
| '@ | ||
|
|
||
| $testScriptList = NormalizeLineEnd -string $testScriptList | ||
|
|
||
| $results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'l 4','list 4') | ||
| $result = @{ | ||
| 'l 4' = if ($results.Count -gt 0) {$results[0].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"} | ||
|
|
@@ -144,7 +156,7 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
| } | ||
|
|
||
| It 'Should show a partial script listing starting on line 4 with the current position on line 5' { | ||
| $result['l 4'] | Should -BeExactly $testScriptList | ||
| (NormalizeLineEnd -string $result['l 4']) | Should -BeExactly $testScriptList | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -164,6 +176,8 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
| 4:* Get-Process -Id $PID > $null | ||
| '@ | ||
|
|
||
| $testScriptList = NormalizeLineEnd -string $testScriptList | ||
|
|
||
| $results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'l 3 2','list 3 2') | ||
| $result = @{ | ||
| 'l 3 2' = if ($results.Count -gt 0) {$results[0].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"} | ||
|
|
@@ -186,7 +200,7 @@ Describe 'Basic debugger command tests' -tag 'CI' { | |
| } | ||
|
|
||
| It 'Should show a partial script listing showing 3 lines starting on line 4 with the current position on line 5' { | ||
| $result['l 3 2'] | Should -BeExactly $testScriptList | ||
| (NormalizeLineEnd -string $result['l 3 2']) | Should -BeExactly $testScriptList | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adityapatwardhan, your last commit had 1 failures in
PowerShell-CI-static-analysisVerify Markdown Links.Verify links in /home/vsts/work/1/s/docs/debugging/README.md.https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/ should work