Skip to content

Commit ff5006e

Browse files
committed
Fix up tests
1 parent df5b99d commit ff5006e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

dsc/tests/dsc_functions.tests.ps1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,23 +695,21 @@ Describe 'tests for function expressions' {
695695
$out.results[0].result.actualState.output | Should -Be $expected
696696
}
697697

698-
# type validation is done on system-level
699698
It 'substring function error handling: <expression>' -TestCases @(
700-
@{ expression = '[substring("hello", -1, 2)]'; expectedError = 'Start index cannot be negative' }
701-
@{ expression = '[substring("hello", 1, -1)]'; expectedError = 'Length cannot be negative' }
702-
@{ expression = '[substring("hello", 10, 1)]'; expectedError = 'Start index is beyond the end of the string' }
703-
@{ expression = '[substring("hello", 2, 10)]'; expectedError = 'Length extends beyond the end of the string' }
699+
@{ expression = "[substring('hello', -1, 2)]"; expectedError = 'Start index cannot be negative' }
700+
@{ expression = "[substring('hello', 1, -1)]"; expectedError = 'Length cannot be negative' }
701+
@{ expression = "[substring('hello', 10, 1)]"; expectedError = 'Start index is beyond the end of the string' }
702+
@{ expression = "[substring('hello', 2, 10)]"; expectedError = 'Length extends beyond the end of the string' }
704703
) {
705704
param($expression, $expectedError)
706705

707-
$escapedExpression = $expression -replace "'", "''"
708706
$config_yaml = @"
709707
`$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
710708
resources:
711709
- name: Echo
712710
type: Microsoft.DSC.Debug/Echo
713711
properties:
714-
output: '$escapedExpression'
712+
output: `"$expression`"
715713
"@
716714
$out = dsc -l trace config get -i $config_yaml 2>$TestDrive/error.log
717715
$LASTEXITCODE | Should -Not -Be 0

0 commit comments

Comments
 (0)