mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
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
47 lines
1.4 KiB
PowerShell
47 lines
1.4 KiB
PowerShell
Describe "Hierarchical paths" {
|
|
BeforeAll {
|
|
$data = "Hello World"
|
|
Setup -File testFile.txt -Content $data
|
|
}
|
|
|
|
It "should work with Join-Path " {
|
|
$testPath = Join-Path $TestDrive testFile.txt
|
|
Get-Content $testPath | Should Be $data
|
|
}
|
|
|
|
It "should work with platform's slashes" {
|
|
$testPath = "$TestDrive$([IO.Path]::DirectorySeparatorChar)testFile.txt"
|
|
Get-Content $testPath | Should Be $data
|
|
}
|
|
|
|
It "should work with forward slashes" {
|
|
$testPath = "$TestDrive/testFile.txt"
|
|
Get-Content $testPath | Should Be $data
|
|
}
|
|
|
|
It "should work with backward slashes" {
|
|
$testPath = "$TestDrive\testFile.txt"
|
|
Get-Content $testPath | Should Be $data
|
|
}
|
|
|
|
It "should work with backward slashes for each separator" {
|
|
$testPath = "$TestDrive\testFile.txt".Replace("/","\")
|
|
Get-Content $testPath | should be $data
|
|
}
|
|
|
|
It "should work with forward slashes for each separator" {
|
|
$testPath = "$TestDrive/testFile.txt".Replace("\","/")
|
|
Get-Content $testPath | should be $data
|
|
}
|
|
|
|
It "should work even if there are too many forward slashes" {
|
|
$testPath = "$TestDrive//////testFile.txt"
|
|
Get-Content $testPath | should be $data
|
|
}
|
|
|
|
It "should work even if there are too many backward slashes" {
|
|
$testPath = "$TestDrive\\\\\\\testFile.txt"
|
|
Get-Content $testPath | should be $data
|
|
}
|
|
}
|