mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix tests broken by removal of aliases
This commit is contained in:
1 parent
47a8ee5bcf
commit
2bd274f5d7
8 files changed
+17
-83
No files matched your search
@@ -35,35 +35,6 @@ Describe "Compare-Object" {
|
||||
{ Compare-Object -ReferenceObject $(Get-Content $file1) $(Get-Content $file2) } | Should Not Throw
|
||||
}
|
||||
|
||||
It "Should be able to execute compare object using the compare alias" {
|
||||
{ compare -ReferenceObject $(Get-Content $file1) -DifferenceObject $(Get-Content $file2) } | Should Not Throw
|
||||
}
|
||||
|
||||
It "Should produce the same output when the compare alias is used" {
|
||||
$alias = compare -ReferenceObject $(Get-Content $file1) -DifferenceObject $(Get-Content $file2)
|
||||
$fullname = Compare-Object -ReferenceObject $(Get-Content $file1) -DifferenceObject $(Get-Content $file2)
|
||||
|
||||
$alias[0].InputObject | Should Be $fullname[0].InputObject
|
||||
$alias[0].SideIndicator | Should Be $fullname[0].SideIndicator
|
||||
$alias[1].InputObject | Should Be $fullname[1].InputObject
|
||||
$alias[1].SideIndicator | Should Be $fullname[1].SideIndicator
|
||||
|
||||
$alias.Length | Should Be 2 # There should be no other elements to test
|
||||
|
||||
}
|
||||
|
||||
It "Should be able to execute compare object using the diff alias" {
|
||||
$alias = diff -ReferenceObject $(Get-Content $file1) -DifferenceObject $(Get-Content $file2)
|
||||
$fullname = Compare-Object -ReferenceObject $(Get-Content $file1) -DifferenceObject $(Get-Content $file2)
|
||||
|
||||
$alias[0].InputObject | Should Be $fullname[0].InputObject
|
||||
$alias[0].SideIndicator | Should Be $fullname[0].SideIndicator
|
||||
$alias[1].InputObject | Should Be $fullname[1].InputObject
|
||||
$alias[1].SideIndicator | Should Be $fullname[1].SideIndicator
|
||||
|
||||
$alias.Length | Should Be 2 # There should be no other elements to test
|
||||
}
|
||||
|
||||
It "Should indicate data that exists only in the reference dataset" {
|
||||
$actualOutput = Compare-Object -ReferenceObject $(Get-Content $file3) -DifferenceObject $(Get-Content $file4)
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ Describe "Export-Alias" {
|
||||
|
||||
Test-Path $fulltestpath | Should Be $true
|
||||
|
||||
$actual = Get-Content $fulltestpath | Sort
|
||||
$actual = Get-Content $fulltestpath | Sort-Object
|
||||
$expected = Get-Command -CommandType Alias
|
||||
|
||||
for ( $i=0; $i -lt $expected.Length; $i++)
|
||||
|
||||
@@ -9,10 +9,6 @@ Describe "Get-ChildItem" {
|
||||
popd
|
||||
}
|
||||
|
||||
It "Should be able to use the ls alias" {
|
||||
$(ls .).Name.Length | Should Be $(Get-ChildItem .).Name.Length
|
||||
}
|
||||
|
||||
It "Should have a the proper fields and be populated" {
|
||||
$var = Get-Childitem .
|
||||
|
||||
|
||||
@@ -40,10 +40,6 @@ Describe "Get-Content" {
|
||||
(Get-Content -Path $testPath) | Should Be $testString
|
||||
}
|
||||
|
||||
It "Should be able to call using the cat alias" {
|
||||
{ cat -Path $testPath } | Should Not Throw
|
||||
}
|
||||
|
||||
It "Should be able to call using the gc alias" {
|
||||
{ gc -Path $testPath } | Should Not Throw
|
||||
}
|
||||
@@ -55,11 +51,9 @@ Describe "Get-Content" {
|
||||
It "Should return the same values for aliases" {
|
||||
$getContentAlias = Get-Content -Path $testPath
|
||||
$gcAlias = gc -Path $testPath
|
||||
$catAlias = cat -Path $testPath
|
||||
$typeAlias = type -Path $testPath
|
||||
|
||||
$getContentAlias | Should Be $gcAlias
|
||||
$getContentAlias | Should Be $catAlias
|
||||
$getContentAlias | Should Be $typeAlias
|
||||
}
|
||||
|
||||
@@ -68,21 +62,21 @@ Describe "Get-Content" {
|
||||
}
|
||||
|
||||
It "Should be able to specify the number of lines to get the content of using the TotalCount switch" {
|
||||
$returnArray = (cat -Path $testPath2 -TotalCount 2)
|
||||
$returnArray = (Get-Content -Path $testPath2 -TotalCount 2)
|
||||
|
||||
$returnArray[0] | Should Be $firstline
|
||||
$returnArray[1] | Should Be $secondline
|
||||
}
|
||||
|
||||
It "Should be able to specify the number of lines to get the content of using the Head switch" {
|
||||
$returnArray = (cat -Path $testPath2 -Head 2)
|
||||
$returnArray = (Get-Content -Path $testPath2 -Head 2)
|
||||
|
||||
$returnArray[0] | Should Be $firstline
|
||||
$returnArray[1] | Should Be $secondline
|
||||
}
|
||||
|
||||
It "Should be able to specify the number of lines to get the content of using the First switch" {
|
||||
$returnArray = (cat -Path $testPath2 -First 2)
|
||||
$returnArray = (Get-Content -Path $testPath2 -First 2)
|
||||
|
||||
$returnArray[0] | Should Be $firstline
|
||||
$returnArray[1] | Should Be $secondline
|
||||
|
||||
@@ -15,6 +15,6 @@ Describe "Get-Item" {
|
||||
}
|
||||
|
||||
It "Should have mode flags set" {
|
||||
ls $PSScriptRoot | foreach-object { $_.Mode | Should Not BeNullOrEmpty }
|
||||
Get-ChildItem $PSScriptRoot | foreach-object { $_.Mode | Should Not BeNullOrEmpty }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,22 @@
|
||||
Describe "NativeLinuxCommands" {
|
||||
It "Should return a type of System.Object for hostname cmdlet" {
|
||||
(hostname).GetType().BaseType | Should Be 'System.Object'
|
||||
(hostname).GetType().Name | Should Be String
|
||||
(hostname).GetType().BaseType | Should Be 'System.Object'
|
||||
(hostname).GetType().Name | Should Be String
|
||||
}
|
||||
|
||||
It "Should have not empty Name flags set for ps object" {
|
||||
ps | foreach-object { $_.ProcessName | Should Not BeNullOrEmpty }
|
||||
Get-Process | foreach-object { $_.ProcessName | Should Not BeNullOrEmpty }
|
||||
}
|
||||
|
||||
It "Should find Application grep" -Skip:$IsWindows {
|
||||
(get-command grep).CommandType | Should Be Application
|
||||
|
||||
It "Should find Application grep" -Skip:$IsWindows {
|
||||
(get-command grep).CommandType | Should Be Application
|
||||
}
|
||||
|
||||
It "Should pipe to grep and get result" -Skip:$IsWindows {
|
||||
"hello world" | grep hello | Should Be "hello world"
|
||||
"hello world" | grep hello | Should Be "hello world"
|
||||
}
|
||||
|
||||
It "Should find Application touch" -Skip:$IsWindows {
|
||||
(get-command touch).CommandType | Should Be Application
|
||||
}
|
||||
|
||||
It "Should find Alias ls" -Skip:$IsWindows {
|
||||
(get-command ls).CommandType | Should Be Alias
|
||||
}
|
||||
|
||||
It "Should find Function mkdir" -Skip:$IsWindows {
|
||||
(get-command mkdir).CommandType | Should Be Function
|
||||
|
||||
It "Should find Application touch" -Skip:$IsWindows {
|
||||
(get-command touch).CommandType | Should Be Application
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,5 @@ Describe "Start-Sleep" {
|
||||
$result = Measure-Command { Start-Sleep -s 1 }
|
||||
$result.TotalSeconds | Should BeGreaterThan 0.25
|
||||
}
|
||||
|
||||
It "Should sleep for at least 1 second using the alias" {
|
||||
$result = Measure-Command { sleep -s 1 }
|
||||
$result.TotalSeconds | Should BeGreaterThan 0.25
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,8 @@ Describe "Tee-Object" {
|
||||
|
||||
It "Should return the output to the screen and to the variable" {
|
||||
$teefile = $testfile
|
||||
echo teeobjecttest1 | Tee-Object -variable teeresults
|
||||
$teeresults | Should Be "teeobjecttest1"
|
||||
Remove-Item $teefile -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It "Should return the output to the screen and to the variable from the alias" {
|
||||
$teefile = $testfile
|
||||
echo teeobjecttest2 | tee -variable teeresults
|
||||
$teeresults | Should Be "teeobjecttest2"
|
||||
echo teeobjecttest1 | Tee-Object -variable teeresults
|
||||
$teeresults | Should Be "teeobjecttest1"
|
||||
Remove-Item $teefile -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
@@ -24,12 +17,5 @@ Describe "Tee-Object" {
|
||||
Get-Content $teefile | Should Be "teeobjecttest3"
|
||||
Remove-Item $teefile -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It "Should tee the output to a file using the alias" {
|
||||
$teefile = $testfile
|
||||
echo teeobjecttest4 | tee $teefile
|
||||
Get-Content $teefile | Should Be "teeobjecttest4"
|
||||
Remove-item $teefile -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user