-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #252 from SteveL-MSFT/resourceid-func
Integrate expressions/functions with DSC
- Loading branch information
Showing
16 changed files
with
430 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
Describe 'tests for function expressions' { | ||
It 'function works: <text>' -TestCases @( | ||
@{ text = "[concat('a', 'b')]"; expected = 'ab' } | ||
@{ text = "[concat('a', 'b', 'c')]"; expected = 'abc' } | ||
@{ text = "[concat('a', 1, concat(2, 'b'))]"; expected = 'a12b' } | ||
@{ text = "[base64('ab')]"; expected = 'YWI=' } | ||
@{ text = "[base64(concat('a','b'))]"; expected = 'YWI=' } | ||
@{ text = "[base64(base64(concat('a','b')))]"; expected = 'WVdJPQ==' } | ||
) { | ||
param($text, $expected) | ||
|
||
$escapedText = $text -replace "'", "''" | ||
$config_yaml = @" | ||
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/config/document.json | ||
resources: | ||
- name: Echo | ||
type: Test/Echo | ||
properties: | ||
text: '$escapedText' | ||
"@ | ||
$out = $config_yaml | dsc config get | ConvertFrom-Json | ||
$out.results[0].result.actualState.text | Should -Be $expected | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.