Skip to content

Commit 12d5fd9

Browse files
committed
Clean up capitalization
1 parent 55ce9c8 commit 12d5fd9

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

Source/Private/MoveUsingStatements.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ function MoveUsingStatements {
3232

3333
# Avoid modifying the file if there's no Parsing Error caused by Using Statements or other errors
3434
if (!$ParseErrors.Where{$_.ErrorId -eq 'UsingMustBeAtStartOfScript'}) {
35-
Write-Debug "No Using Statement Error found."
35+
Write-Debug "No using statement errors found."
3636
return
3737
}
3838
# Avoid modifying the file if there's other parsing errors than Using Statements misplaced
3939
if ($ParseErrors.Where{$_.ErrorId -ne 'UsingMustBeAtStartOfScript'}) {
40-
Write-Warning "Parsing errors found. Skipping Moving Using statements."
40+
Write-Warning "Parsing errors found. Skipping moving using statements."
4141
return
4242
}
4343

@@ -71,9 +71,8 @@ function MoveUsingStatements {
7171
)
7272

7373
if ($ParseErrors) {
74-
Write-Warning "Oops, it seems that we introduced parsing error(s) while moving the Using Statements. Cancelling changes."
75-
}
76-
else {
74+
Write-Warning "We introduced parsing error(s) while attempting to move using statements. Cancelling changes."
75+
} else {
7776
$null = Set-Content -Value $ScriptText -Path $RootModule -Encoding $Encoding
7877
}
7978
}

Tests/Private/MoveUsingStatements.Tests.ps1

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
#requires -Module ModuleBuilder
12
Describe "MoveUsingStatements" {
2-
33
Context "Necessary Parameters" {
44
$CommandInfo = InModuleScope ModuleBuilder { Get-Command MoveUsingStatements }
55

@@ -96,7 +96,7 @@ Describe "MoveUsingStatements" {
9696
$MoveUsingStatementsCmd = InModuleScope ModuleBuilder {
9797
$null = Mock Write-Warning {}
9898
$null = Mock Set-Content {}
99-
$null = Mock Write-Debug {} -ParameterFilter {$Message -eq "No Using Statement Error found." }
99+
$null = Mock Write-Debug {} -ParameterFilter { $Message -eq "No using statement errors found." }
100100

101101
{ param($RootModule)
102102
ConvertToAst $RootModule | MoveUsingStatements
@@ -113,18 +113,17 @@ Describe "MoveUsingStatements" {
113113
Assert-MockCalled -CommandName Set-Content -Times 0 -ModuleName ModuleBuilder
114114
}
115115

116-
It 'Should not do anything when there are no Using Statements Errors' {
117-
116+
It 'Should not do anything when there are no using statement errors' {
118117
$testModuleFile = "$TestDrive\MyModule.psm1"
119-
$PSM1File = "Using namespace System.IO; function x {}"
118+
$PSM1File = "using namespace System.IO; function x {}"
120119
Set-Content $testModuleFile -value $PSM1File -Encoding UTF8
121120

122-
&$MoveUsingStatementsCmd -RootModule $testModuleFile
121+
&$MoveUsingStatementsCmd -RootModule $testModuleFile -Debug
123122

124-
Assert-MockCalled -CommandName Write-Debug -Times 1 -ModuleName ModuleBuilder
125-
Assert-MockCalled -CommandName Set-Content -Times 0 -ModuleName ModuleBuilder
126123
(Get-Content -Raw $testModuleFile).Trim() | Should -Be $PSM1File
127124

125+
Assert-MockCalled -CommandName Set-Content -Times 0 -ModuleName ModuleBuilder
126+
Assert-MockCalled -CommandName Write-Debug -Times 1 -ModuleName ModuleBuilder
128127
}
129128

130129

0 commit comments

Comments
 (0)