@@ -56,13 +56,13 @@ Describe "MoveUsingStatements" {
56
56
ErrorAfter = 0
57
57
},
58
58
@ {
59
- TestCaseName = ' Not move anything if there are (other) parse errors'
59
+ TestCaseName = ' still move statements if there are (other) parse errors'
60
60
PSM1File = " using namespace System.IO`r`n`r`n " +
61
61
" function x { `r`n }`r`n " +
62
62
" using namespace System.Drawing`r`n " + # UsingMustBeAtStartOfScript
63
63
" function y { `r`n }`r`n }" # Extra } at the end
64
64
ErrorBefore = 2
65
- ErrorAfter = 2
65
+ ErrorAfter = 1
66
66
}
67
67
)
68
68
@@ -91,6 +91,7 @@ Describe "MoveUsingStatements" {
91
91
$ErrorFound.Count | Should - Be $ErrorAfter
92
92
}
93
93
}
94
+
94
95
Context " When MoveUsingStatements should do nothing" {
95
96
96
97
$MoveUsingStatementsCmd = InModuleScope ModuleBuilder {
@@ -103,16 +104,6 @@ Describe "MoveUsingStatements" {
103
104
}
104
105
}
105
106
106
- It ' Should Warn and skip when there are Parsing errors other than Using Statements' {
107
- $testModuleFile = " $TestDrive /MyModule.psm1"
108
- $PSM1File = " Using namespace System.IO`r`n function xyz {}`r`n }`r`n Using namespace System.Drawing" # extra } Set-Content $testModuleFile -value $PSM1File -Encoding UTF8
109
- Set-Content $testModuleFile - value $PSM1File - Encoding UTF8
110
-
111
- & $MoveUsingStatementsCmd - RootModule $testModuleFile
112
- Assert-MockCalled - CommandName Write-Warning - Times 1 - ModuleName ModuleBuilder
113
- Assert-MockCalled - CommandName Set-Content - Times 0 - ModuleName ModuleBuilder
114
- }
115
-
116
107
It ' Should not do anything when there are no using statement errors' {
117
108
$testModuleFile = " $TestDrive \MyModule.psm1"
118
109
$PSM1File = " using namespace System.IO; function x {}"
0 commit comments