Windows-powershell / PowerShell-master /test /powershell /Modules /Microsoft.PowerShell.Management /Hierarchical-Path.Tests.ps1
Download PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Management/Hierarchical-Path.Tests.ps1 from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 1.61 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Management/Hierarchical-Path.Tests.ps1
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Management/Hierarchical-Path.Tests.ps1
-
curl -L -o Hierarchical-Path.Tests.ps1 https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Management/Hierarchical-Path.Tests.ps1
1.61 kB
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| Describe "Hierarchical paths" -Tags "CI" { | |
| 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 -BeExactly $data | |
| } | |
| It "should work with platform's slashes" { | |
| $testPath = "$TestDrive$([IO.Path]::DirectorySeparatorChar)testFile.txt" | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| It "should work with forward slashes" { | |
| $testPath = "$TestDrive/testFile.txt" | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| It "should work with backward slashes" { | |
| $testPath = "$TestDrive\testFile.txt" | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| It "should work with backward slashes for each separator" { | |
| $testPath = "$TestDrive\testFile.txt".Replace("/","\") | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| It "should work with forward slashes for each separator" { | |
| $testPath = "$TestDrive/testFile.txt".Replace("\","/") | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| It "should work even if there are too many forward slashes" { | |
| $testPath = "$TestDrive//////testFile.txt" | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| It "should work even if there are too many backward slashes" { | |
| $testPath = "$TestDrive\\\\\\\testFile.txt" | |
| Get-Content $testPath | Should -BeExactly $data | |
| } | |
| } | |