diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 57964c2fe..1cccdabdc 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -207,7 +207,7 @@ namespace System.Management.Automation /// /// X Desktop Group configuration type enum. /// - internal enum XDG_Type + public enum XDG_Type { /// XDG_CONFIG_HOME/powershell CONFIG, @@ -226,7 +226,7 @@ namespace System.Management.Automation /// /// function for choosing directory location of PowerShell for profile loading /// - internal static string SelectProductNameForDirectory(Platform.XDG_Type dirpath) + public static string SelectProductNameForDirectory(Platform.XDG_Type dirpath) { //TODO: XDG_DATA_DIRS implementation as per GitHub issue #1060 diff --git a/test/powershell/enginecore/ModulePath.Tests.ps1 b/test/powershell/enginecore/ModulePath.Tests.ps1 new file mode 100644 index 000000000..57987a134 --- /dev/null +++ b/test/powershell/enginecore/ModulePath.Tests.ps1 @@ -0,0 +1,32 @@ +Describe "Module Path Basic Tests" -tags "CI" { + + It "validate module path on windows" -Skip:(!$IsWindows) { + + $paths = $env:PSModulePath -split [System.IO.Path]::PathSeparator + $paths.Count | Should Be 3 + + $expectedUserPath = Join-Path -Path $HOME -ChildPath 'Documents\PowerShell\Modules' + $paths[0] | Should Be $expectedUserPath + + $expectedSharedPath = Join-Path -Path $env:ProgramFiles -ChildPath 'PowerShell\Modules' + $paths[1] | Should Be $expectedSharedPath + + $expectedSystemPath = Join-Path -Path $PSHOME -ChildPath 'Modules' + $paths[2] | Should Be $expectedSystemPath + } + + It "validate module path on unix" -Skip:($IsWindows) { + + $paths = $env:PSModulePath -split [System.IO.Path]::PathSeparator + $paths.Count | Should Be 3 + + $expectedUserPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("USER_MODULES") + $paths[0] | Should Be $expectedUserPath + + $expectedSharedPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("SHARED_MODULES") + $paths[1] | Should Be $expectedSharedPath + + $expectedSystemPath = Join-Path -Path $PSHOME -ChildPath 'Modules' + $paths[2] | Should Be $expectedSystemPath + } +}