@@ -695,23 +695,21 @@ Describe 'tests for function expressions' {
695
695
$out.results [0 ].result.actualState.output | Should - Be $expected
696
696
}
697
697
698
- # type validation is done on system-level
699
698
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' }
704
703
) {
705
704
param ($expression , $expectedError )
706
705
707
- $escapedExpression = $expression -replace " '" , " ''"
708
706
$config_yaml = @"
709
707
`$ schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
710
708
resources:
711
709
- name: Echo
712
710
type: Microsoft.DSC.Debug/Echo
713
711
properties:
714
- output: ' $escapedExpression '
712
+ output: `" $expression `"
715
713
"@
716
714
$out = dsc - l trace config get - i $config_yaml 2> $TestDrive / error.log
717
715
$LASTEXITCODE | Should -Not - Be 0
0 commit comments