Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ private Collection<PSModuleInfo> GetModulesFromUsingModule(UsingStatementAst usi
return null;
}

// case 1: relative path. Relative for file in the same folder should include .\
bool isPath = fullyQualifiedNameStr.Contains(@"\");
// case 1: relative path. Relative for file in the same folder should include .\ or ./
bool isPath = fullyQualifiedNameStr.Contains('\\') || fullyQualifiedNameStr.Contains('/');
if (isPath && !LocationGlobber.IsAbsolutePath(fullyQualifiedNameStr))
{
string rootPath = Path.GetDirectoryName(_parser._fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ using module Foo
}
}

Context 'Side by side' {
Context 'Side by side' {
Comment thread
TravisEz13 marked this conversation as resolved.
BeforeAll {
# Add side-by-side module
$newVersion = '3.4.5'
Expand Down Expand Up @@ -523,6 +523,19 @@ using module FooForPaths
Pop-Location
}
}

It 'can be accessed by relative path with .<Separator>' -TestCases @(
@{ Separator = '\' },
@{ Separator = '/' }
) {
param([string]$Separator)
$name = 'relative-slash-paths'
'function Get-TestString { "Worked" }' | Set-Content "TestDrive:\modules\$name.psm1"

"using module .$Separator$name.psm1; Get-TestString" | Set-Content "TestDrive:\modules\$name.ps1"

& "TestDrive:\modules\$name.ps1" | Should -BeExactly "Worked"
}
}

Context "module has non-terminating error handled with 'SilentlyContinue'" {
Expand All @@ -547,4 +560,3 @@ using module $testFile
}
}
}