File tree 2 files changed +11
-13
lines changed
src/System.Management.Automation/engine/Modules
test/powershell/Modules/Microsoft.PowerShell.Core
8000
2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -1620,7 +1620,17 @@ internal PSModuleInfo LoadModuleManifest(
1620
1620
if ( bailOnFirstError ) return null ;
1621
1621
}
1622
1622
1623
- string resolvedCommandPrefix = BasePrefix ?? defaultCommandPrefix ?? string . Empty ;
1623
+ string resolvedCommandPrefix = string . Empty ;
1624
+
1625
+ if ( ! string . IsNullOrEmpty ( defaultCommandPrefix ) )
1626
+ {
1627
+ resolvedCommandPrefix = defaultCommandPrefix ;
1628
+ }
16
8000
29
+
1630
+ if ( ! string . IsNullOrEmpty ( this . BasePrefix ) )
1631
+ {
1632
+ resolvedCommandPrefix = this . BasePrefix ;
1633
+ }
1624
1634
1625
1635
if ( ! string . IsNullOrEmpty ( actualRootModule ) )
1626
1636
{
Original file line number Diff line number Diff line change @@ -57,18 +57,6 @@ Describe "Import-Module" -Tags "CI" {
57
57
(Get-Module TestModule).Version | Should - BeIn " 1.1"
58
58
}
59
59
60
-
61
- It ' Should override default command prefix if an empty string is provided' {
62
- $ModuleName = " PrefixTestModule"
<
8000
div aria-hidden="true" style="left:-2px" class="position-absolute top-0 d-flex user-select-none DiffLineTableCellParts-module__in-progress-comment-indicator--hx3m3">63
- $ModulePath = Join-Path - Path $testdrive - ChildPath $ModuleName
64
- $null = New-Item - Path $ModulePath - ItemType Directory - Force
65
- ' function Use-Something{}' | Set-Content - Path " $ModulePath \$ModuleName .psm1" - Force
66
- New-ModuleManifest - Path " $ModulePath \$ModuleName .psd1" - DefaultCommandPrefix MyPrefix - FunctionsToExport Use-Something - RootModule " $ModuleName .psm1"
67
- $ImportedModule = Import-Module - Name " $ModulePath \$ModuleName .psd1" - Prefix " " - PassThru
68
- $ImportedModule.ExportedCommands.ContainsKey (' Use-Something' ) | Should - Be $true
69
- Remove-Module - ModuleInfo $ImportedModule
70
- }
71
-
72
60
It ' ProcessorArchitecture should work' {
73
61
$currentProcessorArchitecture = switch ([System.Runtime.InteropServices.RuntimeInformation ]::ProcessArchitecture) {
74
62
' X86' { ' x86' }
You can’t perform that action at this time.
0 commit comments