mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Restructure of pester test layout
This restructuring moves tests to a directory name which matches the module in which the cmdlet resides which should improve the discoverability of a specific test. For tests which are not about cmdlets in a module, new directories have been created to make those tests easier to find as well
This commit is contained in:
1 parent
ef32e2339e
commit
1e1c4b7dc0
126 files changed
+10
-6
No files matched your search
@@ -0,0 +1,25 @@
|
||||
Describe "DotNetAPI" {
|
||||
$posh_E = 2.718281828459045
|
||||
$posh_pi = 3.14159265358979
|
||||
|
||||
It "Should be able to use static .NET classes and get a constant" {
|
||||
[System.Math]::E | Should Match $posh_E.ToString()
|
||||
[System.Math]::PI | Should Match $posh_pi.ToString()
|
||||
}
|
||||
|
||||
It "Should be able to invoke a method" {
|
||||
[System.Environment]::GetEnvironmentVariable("PATH") | Should Be $env:PATH
|
||||
}
|
||||
|
||||
It "Should not require 'system' in front of static classes" {
|
||||
[Environment]::CommandLine | Should Be ([System.Environment]::CommandLine)
|
||||
|
||||
[Math]::E | Should Be ([System.Math]::E)
|
||||
}
|
||||
|
||||
It "Should be able to create a new instance of a .Net object" {
|
||||
[System.Guid]$guidVal = [System.Guid]::NewGuid()
|
||||
|
||||
$guidVal.GetType().Name | Should Be "Guid"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
Describe ".NET class interoperability" {
|
||||
It "Should access types in System.Console" {
|
||||
[System.Console]::TreatControlCAsInput | Should Be $false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
Describe "ComparisonOperator" {
|
||||
It "Should be $true for 1 -lt 2" {
|
||||
1 -lt 2 | Should Be $true
|
||||
}
|
||||
It "Should be $false for 1 -gt 2" {
|
||||
1 -gt 2 | Should Be $false
|
||||
}
|
||||
It "Should be $true for 1 -le 2" {
|
||||
1 -le 2 | Should Be $true
|
||||
}
|
||||
It "Should be $true for 1 -le 1" {
|
||||
1 -le 1 | Should Be $true
|
||||
}
|
||||
It "Should be $false for 1 -ge 2" {
|
||||
1 -ge 2 | Should Be $false
|
||||
}
|
||||
It "Should be $true for 1 -ge 1" {
|
||||
1 -ge 1 | Should Be $true
|
||||
}
|
||||
It "Should be $true for 1 -eq 1" {
|
||||
1 -eq 1 | Should Be $true
|
||||
}
|
||||
It "Should be $true for 'abc' -ceq 'abc' and $false for 'abc' -ceq 'Abc'" {
|
||||
'abc' -ceq 'abc' | Should Be $true
|
||||
'abc' -ceq 'Abc' | Should Be $false
|
||||
}
|
||||
It "Should be $true for 1 -ne 2" {
|
||||
1 -ne 2 | Should Be $true
|
||||
}
|
||||
|
||||
It "Should be $true for 1 -and 1, $false for 1 -and 0, $false for 0 -and 0" {
|
||||
1 -and 1 | Should Be $true
|
||||
1 -and 0 | Should Be $false
|
||||
0 -and 0 | Should Be $false
|
||||
}
|
||||
It "Should be $true for 1 -or 1, $true for 1 -or 0, $false for 0 -or 0" {
|
||||
1 -or 1 | Should Be $true
|
||||
1 -or 0 | Should Be $true
|
||||
0 -or 0 | Should Be $false
|
||||
}
|
||||
It "Should be $false for -not 1, $true for -not 0" {
|
||||
-not 1 | Should Be $false
|
||||
-not 0 | Should Be $true
|
||||
}
|
||||
It "Should be $false for !1, $true for !0" {
|
||||
!1 | Should Be $false
|
||||
!0 | Should Be $true
|
||||
}
|
||||
|
||||
It "Should be $true for 'Hello','world' -contains 'Hello'" {
|
||||
$arr= 'Hello','world'
|
||||
$arr -contains 'Hello' | Should Be $true
|
||||
}
|
||||
It "Should be $false for 'Hello','world' -ccontains 'hello' and $true for 'Hello','world' -ccontains 'Hello'" {
|
||||
$arr= 'Hello','world'
|
||||
$arr -ccontains 'hello' | Should Be $false
|
||||
$arr -ccontains 'Hello' | Should Be $true
|
||||
}
|
||||
It "Should be $true for 'Hello world' -match 'Hello*'" {
|
||||
"Hello world" -match "Hello*" | Should Be $true
|
||||
}
|
||||
It "Should be $true for 'Hello world' -like 'Hello*'" {
|
||||
"Hello world" -like "Hello*" | Should Be $true
|
||||
}
|
||||
It "Should be $false for 'Hello world' -notmatch 'Hello*'" {
|
||||
"Hello world" -notmatch "Hello*" | Should Be $false
|
||||
}
|
||||
It "Should be $false for 'Hello world' -notlike 'Hello*'" {
|
||||
"Hello world" -notlike "Hello*" | Should Be $false
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user