11Describe " ConvertFrom-SourceLineNumber" {
22 # use the integration test code
3+ BeforeDiscovery {
4+ ${\} = [io.path ]::DirectorySeparatorChar
5+
6+ $TestCases = @ (
7+ @ {
8+ outputLine = 40 ;
9+ sourceFile = " .${\} Private${\} TestUnExportedAliases.ps1" ;
10+ sourceLine = 13 ;
11+ Module = " $PSScriptRoot ${\} ..${\} Integration${\} Result1${\} Source1${\} 1.0.0${\} Source1.psm1"
12+ }
13+ @ {
14+ outputLine = 48 ;
15+ sourceFile = " .${\} Public${\} Get-Source.ps1" ;
16+ sourceLine = 5 ;
17+ Module = " $PSScriptRoot ${\} ..${\} Integration${\} Result1${\} Source1${\} 1.0.0${\} Source1.psm1"
18+ }
19+ @ {
20+ outputLine = 56 ;
21+ sourceFile = " .${\} Public${\} Set-Source.ps1" ;
22+ sourceLine = 3 ;
23+ Module = " $PSScriptRoot ${\} ..${\} Integration${\} Result1${\} Source1${\} 1.0.0${\} Source1.psm1"
24+ }
25+ )
26+ }
327 BeforeAll {
4- Build-Module $PSScriptRoot / ../ Integration/ Source1/ build.psd1 - Passthru
28+ ${\} = [io.path ]::DirectorySeparatorChar
29+ Build-Module " $PSScriptRoot ${\} ..${\} Integration${\} Source1${\} build.psd1" - Passthru
530 Push-Location $PSScriptRoot - StackName ConvertFrom-SourceLineNumber
631
7- $global :Convert_LineNumber_ModulePath = Convert-Path " $PSScriptRoot /../Integration/Result1/Source1/1.0.0/Source1.psm1"
8- $global :Convert_LineNumber_ModuleSource = Convert-Path " $PSScriptRoot /../Integration/Source1"
9- $global :Convert_LineNumber_ModuleContent = Get-Content $global :Convert_LineNumber_ModulePath
10- ${global :\} = [io.path ]::DirectorySeparatorChar
11-
12- $global :TestCases = @ (
13- @ { outputLine = 40 ; sourceFile = " .${\} Private${\} TestUnExportedAliases.ps1" ; sourceLine = 13 ; Module = $Convert_LineNumber_ModulePath }
14- @ { outputLine = 48 ; sourceFile = " .${\} Public${\} Get-Source.ps1" ; sourceLine = 5 ; Module = $Convert_LineNumber_ModulePath }
15- @ { outputLine = 56 ; sourceFile = " .${\} Public${\} Set-Source.ps1" ; sourceLine = 3 ; Module = $Convert_LineNumber_ModulePath }
16- )
32+ $Convert_LineNumber_ModuleContent = Get-Content " $PSScriptRoot ${\} ..${\} Integration${\} Result1${\} Source1${\} 1.0.0${\} Source1.psm1"
33+ ${\} = [io.path ]::DirectorySeparatorChar
1734 }
1835 AfterAll {
1936 Pop-Location - StackName ConvertFrom-SourceLineNumber
@@ -22,9 +39,10 @@ Describe "ConvertFrom-SourceLineNumber" {
2239 It " Should map line <sourceLine> in the source of <sourceFile> to line <outputLine> in the Module" - TestCases $TestCases {
2340 param ($outputLine , $sourceFile , $sourceLine , $module )
2441
25- $sourcePath = Join-Path $Convert_LineNumber_ModuleSource $SourceFile | Convert-Path
42+ ${\} = [io.path ]::DirectorySeparatorChar
43+ $sourcePath = Join-Path " $PSScriptRoot ${\} ..${\} Integration${\} Source1" $SourceFile | Convert-Path
2644 $OutputLocation = ConvertFrom-SourceLineNumber $sourcePath $sourceLine - Module $module
27- # $OutputLocation.Script | Should -Be $Convert_LineNumber_ModulePath
45+ # $OutputLocation.Script | Should -Be "$PSScriptRoot/../Integration/Result1/Source1/1.0.0/Source1.psm1"
2846 $OutputLocation.Line | Should - Be $outputLine
2947
3048 $line = (Get-Content $sourcePath )[$sourceLine - 1 ]
@@ -36,7 +54,8 @@ Describe "ConvertFrom-SourceLineNumber" {
3654 }
3755
3856 It " Should warn if the SourceFile doesn't exist" {
39- ConvertFrom-SourceLineNumber - SourceFile TestDrive:/ NoSuchFile - SourceLineNumber 10 - Module $Convert_LineNumber_ModulePath - WarningVariable Warns
40- $Warns | Should - Be " 'TestDrive:/NoSuchFile' not found in $Convert_LineNumber_ModulePath "
57+ ${\} = [io.path ]::DirectorySeparatorChar
58+ ConvertFrom-SourceLineNumber - SourceFile " TestDrive:${\} NoSuchFile" - SourceLineNumber 10 - Module " $PSScriptRoot ${\} ..${\} Integration${\} Result1${\} Source1${\} 1.0.0${\} Source1.psm1" - WarningVariable Warns
59+ $Warns | Should - Be " 'TestDrive:${\} NoSuchFile' not found in $PSScriptRoot ${\} ..${\} Integration${\} Result1${\} Source1${\} 1.0.0${\} Source1.psm1"
4160 }
4261}
0 commit comments