forked from puppetlabs/puppet-editor-services
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(puppetlabsGH-141) Add tests for Puppet Language Functions
Previously the function loader was modified for V4 Function API however there were no tests for the Puppet based Functions, as opposed to Ruby. This commit adds the test fixtures and tests to ensure that Puppet based Functions are loaded correctly.
- Loading branch information
1 parent
5299cbd
commit 7d603fd
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...xtures/real_agent/environments/testfixtures/modules/defaultmodule/functions/puppetfunc.pp
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,13 @@ | ||
# An example puppet function, as opposed to a ruby custom function | ||
# | ||
# @example Declaring the class | ||
# $test = defaultmodule::puppetfunc('true') | ||
# | ||
# @param arg The first parameter for this function. | ||
function defaultmodule::puppetfunc(Variant[String, Boolean] $arg) >> String { | ||
case $arg { | ||
false, undef, /(?i:false)/ : { 'Off' } | ||
true, /(?i:true)/ : { 'On' } | ||
default : { "$arg" } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
spec/languageserver-sidecar/fixtures/valid_module_workspace/functions/modulefunc.pp
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,13 @@ | ||
# An example puppet function in a module, as opposed to a ruby custom function | ||
# | ||
# @example Declaring the class | ||
# $test = valid::modulefunc('true') | ||
# | ||
# @param p1 The first parameter for this function. | ||
function valid::modulefunc(Variant[String, Boolean] $p1) >> String { | ||
case $p1 { | ||
false, undef, /(?i:false)/ : { 'Off' } | ||
true, /(?i:true)/ : { 'On' } | ||
default : { "$p1" } | ||
} | ||
} |
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