Skip to content

Commit 2cfdbb5

Browse files
author
James Brundage
committed
Adding tests for Update-PipeScript
1 parent 49bfc34 commit 2cfdbb5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Tests/Update-PipeScript.tests.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ describe Update-PipeScript {
44
Update-PipeScript -ScriptBlock { $v } -RenameVariable @{v='x'} |
55
Should -BeLike '*$x*'
66
}
7+
8+
it 'Can remove a region' {
9+
Update-ScriptBlock {
10+
#region Before
11+
Before
12+
#endregion Before
13+
#region After
14+
After
15+
#endregion After
16+
} -ReplaceRegion @{"Before"= ""} | Should -BeLike *after*
17+
}
718
}
819

920
context 'Updating text' {
@@ -32,7 +43,7 @@ describe Update-PipeScript {
3243

3344
Update-PipeScript -ScriptBlock { dynamicParam { hello } } -Append { goodbye } | Should -BeLike '*dynamicParam*{*hello*goodbye*}*'
3445

35-
Update-PipeScript -ScriptBlock { dynamicParam { hello } end { } } -Append { goodbye } | Should -BeLike '*dynamicParam*{*hello*goodbye*}*'
46+
Update-PipeScript -ScriptBlock { dynamicParam { hello } end { } } -Append { goodbye } | Should -BeLike '*dynamicParam*{*hello*}*end*{*goodbye*}*'
3647
}
3748
}
3849
}

0 commit comments

Comments
 (0)