@@ -134,43 +134,44 @@ Describe 'Include tests' {
134
134
135
135
It ' Multiple includes' {
136
136
$echoConfig = @'
137
- $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
138
- resources:
139
- - name: one
140
- type: Test/Echo
141
- properties:
142
- output: one
137
+ $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
138
+ resources:
139
+ - name: one
140
+ type: Test/Echo
141
+ properties:
142
+ output: one
143
143
'@
144
144
145
145
$echoConfigPath = Join-Path $TestDrive ' echo.dsc.yaml'
146
- $echoConfig | Set-Content - Path $echoConfigPath
147
- $echoConfigPathParent = Split-Path $echoConfigPath - Parent
148
- $echoConfigPathLeaf = Split-Path $echoConfigPath - Leaf
149
- $directorySeparator = [System.IO.Path ]::DirectorySeparatorChar
146
+ $echoConfig | Set-Content - Path $echoConfigPath - Encoding utf8
147
+ # need to escape backslashes for YAML
148
+ $echoConfigPathParent = (Split-Path $echoConfigPath - Parent).Replace(' \' , ' \\' )
149
+ $echoConfigPathLeaf = (Split-Path $echoConfigPath - Leaf).Replace(' \' , ' \\' )
150
+ $directorySeparator = [System.IO.Path ]::DirectorySeparatorChar.ToString().Replace(' \' , ' \\' )
150
151
151
152
$nestedIncludeConfig = @"
152
- `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
153
- resources:
154
- - name: nested
155
- type: Microsoft.DSC/Include
156
- properties:
157
- configurationFile: "[concat('$echoConfigPathParent ', '$directorySeparator ', '$echoConfigPathLeaf ')]"
153
+ `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
154
+ resources:
155
+ - name: nested
156
+ type: Microsoft.DSC/Include
157
+ properties:
158
+ configurationFile: "[concat('$echoConfigPathParent ', '$directorySeparator ', '$echoConfigPathLeaf ')]"
158
159
"@
159
160
160
161
$nestedIncludeConfigPath = Join-Path $TestDrive ' nested_include.dsc.yaml'
161
- $nestedIncludeConfig | Set-Content - Path $nestedIncludeConfigPath
162
+ $nestedIncludeConfig | Set-Content - Path $nestedIncludeConfigPath - Encoding utf8
162
163
163
164
$includeConfig = @"
164
- `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
165
- resources:
166
- - name: include
167
- type: Microsoft.DSC/Include
168
- properties:
169
- configurationFile: $echoConfigPath
170
- - name: include nested
171
- type: Microsoft.DSC/Include
172
- properties:
173
- configurationFile: $nestedIncludeConfigPath
165
+ `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
166
+ resources:
167
+ - name: include
168
+ type: Microsoft.DSC/Include
169
+ properties:
170
+ configurationFile: $echoConfigPath
171
+ - name: include nested
172
+ type: Microsoft.DSC/Include
173
+ properties:
174
+ configurationFile: $nestedIncludeConfigPath
174
175
"@
175
176
176
177
$out = $includeConfig | dsc config get | ConvertFrom-Json
0 commit comments