Windows-powershell / PowerShell-master /test /powershell /engine /Module /UpdateModuleManifest.Tests.ps1
Download PowerShell-master/test/powershell/engine/Module/UpdateModuleManifest.Tests.ps1 from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/engine/Module/UpdateModuleManifest.Tests.ps1
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/powershell/engine/Module/UpdateModuleManifest.Tests.ps1
-
curl -L -o UpdateModuleManifest.Tests.ps1 https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/engine/Module/UpdateModuleManifest.Tests.ps1
1.54 kB
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| Describe "Update-ModuleManifest tests" -tags "CI" { | |
| BeforeEach { | |
| $testModulePath = "testdrive:/module/test.psd1" | |
| New-Item -ItemType Directory -Path testdrive:/module > $null | |
| } | |
| AfterEach { | |
| Remove-Item -Recurse -Force -ErrorAction SilentlyContinue testdrive:/module | |
| } | |
| It "Update should not clear out NestedModules: <variation>" -TestCases @( | |
| @{ variation = "export with wildcards"; exportValue = "*" }, | |
| @{ variation = "export without wildcards"; exportValue = "@()"} | |
| ) { | |
| param($exportValue) | |
| New-Item -ItemType File -Path testdrive:/module/foo.psm1 > $null | |
| New-ModuleManifest -Path $testModulePath -NestedModules foo.psm1 -HelpInfoUri http://foo.com -AliasesToExport $exportValue -CmdletsToExport $exportValue -FunctionsToExport $exportValue -VariablesToExport $exportValue -DscResourcesToExport $exportValue | |
| $module = Test-ModuleManifest -Path $testModulePath | |
| $module.HelpInfoUri | Should -BeExactly "http://foo.com/" | |
| $module.NestedModules | Should -HaveCount 1 | |
| $module.NestedModules.Name | Should -BeExactly foo | |
| Update-ModuleManifest -Path $testModulePath -HelpInfoUri https://bar.org | |
| $module = Test-ModuleManifest -Path $testModulePath | |
| $module.HelpInfoUri | Should -BeExactly "https://bar.org/" | |
| $module.NestedModules | Should -HaveCount 1 | |
| $module.NestedModules.Name | Should -BeExactly foo | |
| } | |
| } | |