Reformat Measure-Object test (#4972)

Remove multiple tabs and formatting issues.
This commit is contained in:
Ilya 2017-10-03 07:39:51 +04:00 committed by GitHub
parent f69b760f2b
commit 6a68262ba2

View file

@ -1,5 +1,7 @@
Describe "Measure-Object" -Tags "CI" { Describe "Measure-Object" -Tags "CI" {
BeforeAll {
$testObject = 1,3,4 $testObject = 1,3,4
}
It "Should be able to be called without error" { It "Should be able to be called without error" {
{ Measure-Object | Out-Null } | Should Not Throw { Measure-Object | Out-Null } | Should Not Throw
@ -71,7 +73,6 @@ Describe "Measure-Object" -Tags "CI" {
{ {
if ( $testObject[$i] -lt $expected ) if ( $testObject[$i] -lt $expected )
{ {
$expected = $testObject[$i] $expected = $testObject[$i]
} }
} }
@ -88,7 +89,6 @@ Describe "Measure-Object" -Tags "CI" {
{ {
if ( $testMinimum[$i] -lt $expected ) if ( $testMinimum[$i] -lt $expected )
{ {
$expected = $testMinimum[$i] $expected = $testMinimum[$i]
} }
} }
@ -104,7 +104,6 @@ Describe "Measure-Object" -Tags "CI" {
{ {
if ( $testObject[$i] -gt $expected ) if ( $testObject[$i] -gt $expected )
{ {
$expected = $testObject[$i] $expected = $testObject[$i]
} }
} }
@ -121,7 +120,6 @@ Describe "Measure-Object" -Tags "CI" {
{ {
if ( $testMaximum[$i] -gt $expected ) if ( $testMaximum[$i] -gt $expected )
{ {
$expected = $testMaximum[$i] $expected = $testMaximum[$i]
} }
} }
@ -131,9 +129,10 @@ Describe "Measure-Object" -Tags "CI" {
} }
Context "String tests" { Context "String tests" {
BeforeAll {
$nl = [Environment]::NewLine $nl = [Environment]::NewLine
$testString = "HAD I the heavens' embroidered cloths,$nl Enwrought with golden and silver light,$nl The blue and the dim and the dark cloths$nl Of night and light and the half light,$nl I would spread the cloths under your feet:$nl But I, being poor, have only my dreams;$nl I have spread my dreams under your feet;$nl Tread softly because you tread on my dreams." $testString = "HAD I the heavens' embroidered cloths,$nl Enwrought with golden and silver light,$nl The blue and the dim and the dark cloths$nl Of night and light and the half light,$nl I would spread the cloths under your feet:$nl But I, being poor, have only my dreams;$nl I have spread my dreams under your feet;$nl Tread softly because you tread on my dreams."
}
It "Should be able to count the number of words in a string" { It "Should be able to count the number of words in a string" {
$expectedLength = $testString.Replace($nl,"").Split().length $expectedLength = $testString.Replace($nl,"").Split().length
@ -159,7 +158,6 @@ Describe "Measure-Object" -Tags "CI" {
} }
Describe "Measure-Object DRT basic functionality" -Tags "CI" { Describe "Measure-Object DRT basic functionality" -Tags "CI" {
BeforeAll { BeforeAll {
if(-not ([System.Management.Automation.PSTypeName]'TestMeasureGeneric').Type) if(-not ([System.Management.Automation.PSTypeName]'TestMeasureGeneric').Type)
{ {
@ -174,6 +172,7 @@ Describe "Measure-Object DRT basic functionality" -Tags "CI" {
} }
"@ "@
} }
if(-not ([System.Management.Automation.PSTypeName]'TestMeasureText').Type) if(-not ([System.Management.Automation.PSTypeName]'TestMeasureText').Type)
{ {
Add-Type -TypeDefinition @" Add-Type -TypeDefinition @"
@ -187,6 +186,7 @@ Describe "Measure-Object DRT basic functionality" -Tags "CI" {
} }
"@ "@
} }
$employees = [pscustomobject]@{"FirstName"="joseph"; "LastName"="smith"; "YearsInMS"=15}, $employees = [pscustomobject]@{"FirstName"="joseph"; "LastName"="smith"; "YearsInMS"=15},
[pscustomobject]@{"FirstName"="paul"; "LastName"="smith"; "YearsInMS"=15}, [pscustomobject]@{"FirstName"="paul"; "LastName"="smith"; "YearsInMS"=15},
[pscustomobject]@{"FirstName"="mary jo"; "LastName"="soe"; "YearsInMS"=5}, [pscustomobject]@{"FirstName"="mary jo"; "LastName"="soe"; "YearsInMS"=5},
@ -302,7 +302,7 @@ Describe "Measure-Object DRT basic functionality" -Tags "CI" {
} }
It "Measure-Object with multiple lines should work"{ It "Measure-Object with multiple lines should work"{
$result = "123`n4"|measure-object -line $result = "123`n4" | Measure-Object -Line
$result.Lines | Should Be 2 $result.Lines | Should Be 2
} }
} }