Skip to content

Commit

Permalink
fixing appveyor if stmts and test cases for filter string #57 #55
Browse files Browse the repository at this point in the history
  • Loading branch information
sayedihashimi committed Apr 22, 2015
1 parent 62e7c3e commit 304428c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/psbuild.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ function Invoke-MSBuild{
'Using msbuild.exe from "{0}". You can use Set-MSBuild to update this.' -f $msbuildPath | Write-BuildMessage
}

if($env:APPVEYOR -eq $true -and (get-command Add-AppveyorMessage -ErrorAction SilentlyContinue) ){
if( ($env:APPVEYOR -eq $true) -and (get-command Add-AppveyorMessage -ErrorAction SilentlyContinue) ){
[string]$projstr = $projArg
if([string]::IsNullOrWhiteSpace($projstr)){
$projstr = '(project not specified)'
Expand All @@ -648,7 +648,7 @@ function Invoke-MSBuild{

if(-not $ignoreExitCode -and ($LASTEXITCODE -ne 0)){
$msg = ('MSBuild exited with a non-zero exit code [{0}]' -f $LASTEXITCODE)
if($env:APPVEYOR -eq $true -and (get-command Add-AppveyorMessage -ErrorAction SilentlyContinue) ){
if( ($env:APPVEYOR -eq $true) -and (get-command Add-AppveyorMessage -ErrorAction SilentlyContinue) ){
$msbcommand = ('"{0}" {1}' -f $msbuildPath, ($msbuildArgs -join ' ' ))
$summary = ("The command exited with a non-zero exit code [{0}]" -f $LASTEXITCODE)
$msg = ("{0}.`nCommand:[{1}]" -f $summary, $msbcommand)
Expand Down
14 changes: 7 additions & 7 deletions tests/psbuild.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Describe "nologs tests"{
}
}

Describe 'filter-string tests'{
Describe 'Get-FilteredString tests'{
$originalMessage =
@'
Lorem ipsum dolor sit amet, semper adipiscing elit. Integer vulputate dui non venenatis sollicitudin. Aliquam nec sapien ut justo bibendum aliquet nec vestibulum leo.
Expand All @@ -255,36 +255,36 @@ semperet accumsan urna maximus nec. Fusce pulvinar justo a maximus ullamcorper.

It 'can perform single replace via param'{
$expectedResult = $originalMessage.Replace('semper',$defaultMask)
Filter-String -message $originalMessage -textToRemove 'semper' | Should be $expectedResult
Get-FilteredString -message $originalMessage -textToRemove 'semper' | Should be $expectedResult
}

It 'can perform multiple replace via param'{
$expectedResult = ($originalMessage.Replace('semper',$defaultMask).Replace('accumsan',$defaultMask))
Filter-String -message $originalMessage -textToRemove 'semper','accumsan' | Should Be $expectedResult
Get-FilteredString -message $originalMessage -textToRemove 'semper','accumsan' | Should Be $expectedResult
}

It 'can replace single value via global settings'{
$global:FilterStringSettings.GlobalReplacements += 'semper'
$expectedResult = $originalMessage.Replace('semper',$defaultMask)
Filter-String -message $originalMessage | Should be $expectedResult
Get-FilteredString -message $originalMessage | Should be $expectedResult
}

It 'can replace multiple values via global settings'{
$global:FilterStringSettings.GlobalReplacements += 'semper','accumsan'
$expectedResult = ($originalMessage.Replace('semper',$defaultMask).Replace('accumsan',$defaultMask))
Filter-String -message $originalMessage | Should be $expectedResult
Get-FilteredString -message $originalMessage | Should be $expectedResult
}

It 'can replace with parameter and global settings'{
$global:FilterStringSettings.GlobalReplacements += 'accumsan'
$expectedResult = ($originalMessage.Replace('semper',$defaultMask).Replace('accumsan',$defaultMask))
Filter-String -message $originalMessage -textToRemove 'semper' | Should be $expectedResult
Get-FilteredString -message $originalMessage -textToRemove 'semper' | Should be $expectedResult
}

It 'can replace with a custom mask'{
$mask = '*****'
$expectedResult = ($originalMessage.Replace('semper',$mask).Replace('accumsan',$mask))
Filter-String -message $originalMessage -textToRemove 'semper','accumsan' -mask $mask | Should Be $expectedResult
Get-FilteredString -message $originalMessage -textToRemove 'semper','accumsan' -mask $mask | Should Be $expectedResult
}

}

0 comments on commit 304428c

Please sign in to comment.