mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
deleting trailing whitespace
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Describe "test-Add-Member" {
|
||||
|
||||
|
||||
It "should be able to see a newly added member of an object" {
|
||||
$o = New-Object psobject
|
||||
Add-Member -InputObject $o -MemberType NoteProperty -Name proppy -Value "superVal"
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
It "Should be able to access the members of the environment variable in two ways" {
|
||||
(Get-Item ENV:HOME).Value | Should be "/root"
|
||||
(Get-Item ENV:HOSTNAME).Value | Should Not BeNullOrEmpty
|
||||
(Get-Item ENV:PATH).Value | Should Not BeNullOrEmpty
|
||||
(Get-Item ENV:HOSTNAME).Value | Should Not BeNullOrEmpty
|
||||
(Get-Item ENV:PATH).Value | Should Not BeNullOrEmpty
|
||||
|
||||
(ls ENV:HOME).Value | Should be "/root"
|
||||
(ls ENV:HOSTNAME).Value | Should Not BeNullOrEmpty
|
||||
(ls ENV:PATH).Value | Should Not BeNullOrEmpty
|
||||
(ls ENV:HOSTNAME).Value | Should Not BeNullOrEmpty
|
||||
(ls ENV:PATH).Value | Should Not BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
Describe "Get-Alias" {
|
||||
It "Should have a return type of System.Array when gal returns more than one object" {
|
||||
$val1=(Get-Alias a*)
|
||||
$val2=(Get-Alias c*)
|
||||
$i=0
|
||||
$val1=(Get-Alias a*)
|
||||
$val2=(Get-Alias c*)
|
||||
$i=0
|
||||
|
||||
$val1 | ForEach-Object{ $i++};
|
||||
if($i -lt 2) {
|
||||
$val1.GetType().BaseType.FullName | Should Be "System.Management.Automation.CommandInfo"
|
||||
}
|
||||
else {
|
||||
$val1.GetType().BaseType.FullName | Should Be "System.Array"
|
||||
}
|
||||
$val1 | ForEach-Object{ $i++};
|
||||
if($i -lt 2) {
|
||||
$val1.GetType().BaseType.FullName | Should Be "System.Management.Automation.CommandInfo"
|
||||
}
|
||||
else
|
||||
{
|
||||
$val1.GetType().BaseType.FullName | Should Be "System.Array"
|
||||
}
|
||||
|
||||
$val2 | ForEach-Object{ $i++};
|
||||
if($i -lt 2) {
|
||||
$val2.GetType().BaseType.FullName | Should Be "System.Management.Automation.CommandInfo"
|
||||
}
|
||||
else {
|
||||
$val2.GetType().BaseType.FullName | Should Be "System.Array"
|
||||
}
|
||||
$val2 | ForEach-Object{ $i++};
|
||||
if($i -lt 2) {
|
||||
$val2.GetType().BaseType.FullName | Should Be "System.Management.Automation.CommandInfo"
|
||||
}
|
||||
else
|
||||
{
|
||||
$val2.GetType().BaseType.FullName | Should Be "System.Array"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
It "should return an array of 3 objects" {
|
||||
$val = Get-Alias a*
|
||||
$alias = gal a*
|
||||
$val = Get-Alias a*
|
||||
$alias = gal a*
|
||||
|
||||
$val.CommandType | Should Not BeNullOrEmpty
|
||||
$val.Name | Should Not BeNullOrEmpty
|
||||
$val.ModuleName | Should BeNullOrEmpty
|
||||
|
||||
$alias.CommandType | Should Not BeNullOrEmpty
|
||||
$alias.Name | Should Not BeNullOrEmpty
|
||||
$alias.ModuleName | Should BeNullOrEmpty
|
||||
$alias.CommandType | Should Not BeNullOrEmpty
|
||||
$alias.Name | Should Not BeNullOrEmpty
|
||||
$alias.ModuleName | Should BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "Test-Get-ChildItem" {
|
||||
Describe "Test-Get-ChildItem" {
|
||||
It "Should list the contents of the current folder" {
|
||||
(Get-ChildItem .).Name.Length | Should BeGreaterThan 0
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "Test-Get-Date" {
|
||||
Describe "Test-Get-Date" {
|
||||
<#
|
||||
1. foreach
|
||||
2.
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "Test-Get-Item" {
|
||||
Describe "Test-Get-Item" {
|
||||
It "Should list all the items in the current working directory when asterisk is used" {
|
||||
(Get-Item *).GetType().BaseType | Should Be 'array'
|
||||
(Get-Item *).GetType().Name | Should Be 'Object[]'
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "Test-Get-Location aka pwd" {
|
||||
Describe "Test-Get-Location aka pwd" {
|
||||
<#Dependencies:
|
||||
pushd
|
||||
popd
|
||||
@@ -26,4 +22,4 @@ Describe "Test-Get-Location aka pwd" {
|
||||
(pwd).Path | Should Not BeNullOrEmpty
|
||||
(pwd).Path | Should Be ($winHome -or $nixHome)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "Test-Get-Member" {
|
||||
Describe "Test-Get-Member" {
|
||||
It "Should be able to be called on string objects, ints, arrays, etc" {
|
||||
$a = 1 #test numbers
|
||||
$b = 1.3
|
||||
@@ -10,7 +6,7 @@ Describe "Test-Get-Member" {
|
||||
$d = @(1,3) # test arrays
|
||||
$e = "anoeduntodeu" #test strings
|
||||
$f = 'asntoheusth' #test strings
|
||||
|
||||
|
||||
Get-Member -InputObject $a | Should Not BeNullOrEmpty
|
||||
Get-Member -InputObject $b | Should Not BeNullOrEmpty
|
||||
Get-Member -InputObject $c | Should Not BeNullOrEmpty
|
||||
@@ -42,4 +38,4 @@ Describe "Test-Get-Member" {
|
||||
|
||||
Get-Member -InputObject $o | Should Not BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
|
||||
Describe "Test-Get-PSDrive" {
|
||||
Describe "Test-Get-PSDrive" {
|
||||
It "Should not throw" {
|
||||
Get-PSDrive | Should Not BeNullOrEmpty
|
||||
(Get-PSDrive).Name | Should Not BeNullOrEmpty
|
||||
Get-PSDrive | Should Not BeNullOrEmpty
|
||||
(Get-PSDrive).Name | Should Not BeNullOrEmpty
|
||||
(Get-PSDrive).Root.Length | Should Not BeLessThan 1
|
||||
|
||||
gdr | Should Not BeNullOrEmpty
|
||||
(gdr).Name | Should Not BeNullOrEmpty
|
||||
gdr | Should Not BeNullOrEmpty
|
||||
(gdr).Name | Should Not BeNullOrEmpty
|
||||
(gdr).Root.Length | Should Not BeLessThan 1
|
||||
}
|
||||
|
||||
It "Should return drive info"{
|
||||
(Get-PSDrive Env).Name | Should Be Env
|
||||
(Get-PSDrive /).Root | Should Be /
|
||||
(Get-PSDrive Env).Name | Should Be Env
|
||||
(Get-PSDrive /).Root | Should Be /
|
||||
(Get-PSDrive /).Provider.Name | Should Be FileSystem
|
||||
|
||||
(gdr Env).Name | Should Be Env
|
||||
(gdr /).Root | Should Be /
|
||||
(gdr Env).Name | Should Be Env
|
||||
(gdr /).Root | Should Be /
|
||||
(gdr /).Provider.Name | Should Be FileSystem
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "New-Object" {
|
||||
Describe "New-Object" {
|
||||
It "should create an object with 4 fields" {
|
||||
$o = New-Object psobject
|
||||
$val = $o.GetType()
|
||||
|
||||
$val.IsPublic | Should Not BeNullOrEmpty
|
||||
$val.Name | Should Not BeNullOrEmpty
|
||||
$val.IsPublic | Should Not BeNullOrEmpty
|
||||
$val.Name | Should Not BeNullOrEmpty
|
||||
$val.IsSerializable | Should Not BeNullOrEmpty
|
||||
$val.BaseType | Should Not BeNullOrEmpty
|
||||
$val.BaseType | Should Not BeNullOrEmpty
|
||||
|
||||
$val.IsPublic | Should Be $true
|
||||
$val.IsPublic | Should Be $true
|
||||
$val.IsSerializable | Should Be $false
|
||||
$val.Name | Should Be 'PSCustomObject'
|
||||
$val.BaseType | Should Be 'System.Object'
|
||||
$val.Name | Should Be 'PSCustomObject'
|
||||
$val.BaseType | Should Be 'System.Object'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
It "Should have the right version table entries" {
|
||||
|
||||
$PSVersionTable.ContainsKey("PSVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("WSManStackVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("SerializationVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("CLRVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("BuildVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("PSCompatibleVersions") | Should Be True
|
||||
$PSVersionTable.ContainsKey("PSVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("WSManStackVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("SerializationVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("CLRVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("BuildVersion") | Should Be True
|
||||
$PSVersionTable.ContainsKey("PSCompatibleVersions") | Should Be True
|
||||
$PSVersionTable.ContainsKey("PSRemotingProtocolVersion") | Should Be True
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Describe "Test-Split-Path" {
|
||||
Describe "Test-Split-Path" {
|
||||
<#
|
||||
Dependencies:
|
||||
1. Split-Path - FUT
|
||||
@@ -12,8 +8,8 @@ Describe "Test-Split-Path" {
|
||||
|
||||
#>
|
||||
It "Should return a string object when invoked" {
|
||||
(Split-Path .).GetType().Name |Should Be "String"
|
||||
(Split-Path . -Leaf).GetType().Name | Should Be "String"
|
||||
(Split-Path .).GetType().Name | Should Be "String"
|
||||
(Split-Path . -Leaf).GetType().Name | Should Be "String"
|
||||
(Split-Path . -Resolve).GetType().Name | Should Be "String"
|
||||
}
|
||||
|
||||
@@ -30,8 +26,8 @@ Describe "Test-Split-Path" {
|
||||
}
|
||||
|
||||
It "Should be able to tell if a given path is an absolute path" {
|
||||
(Split-Path /usr/bin -IsAbsolute) |Should be $true
|
||||
(Split-Path . -IsAbsolute) | Should be $false
|
||||
(Split-Path /usr/bin -IsAbsolute) | Should be $true
|
||||
(Split-Path . -IsAbsolute) | Should be $false
|
||||
}
|
||||
|
||||
It "Should support piping" {
|
||||
|
||||
Reference in New Issue
Block a user