changeset 37:addb0ea390a1 puppet-3.6

Update Puppet "stdlib" module
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2015 20:09:45 +0000
parents 37675581a273
children a1960fb961c5
files modules/stdlib/CHANGELOG modules/stdlib/CHANGELOG.md modules/stdlib/CONTRIBUTING.md modules/stdlib/Gemfile modules/stdlib/Modulefile modules/stdlib/README.markdown modules/stdlib/Rakefile modules/stdlib/checksums.json modules/stdlib/lib/facter/facter_dot_d.rb modules/stdlib/lib/facter/root_home.rb modules/stdlib/lib/puppet/parser/functions/base64.rb modules/stdlib/lib/puppet/parser/functions/bool2num.rb modules/stdlib/lib/puppet/parser/functions/bool2str.rb modules/stdlib/lib/puppet/parser/functions/camelcase.rb modules/stdlib/lib/puppet/parser/functions/capitalize.rb modules/stdlib/lib/puppet/parser/functions/chomp.rb modules/stdlib/lib/puppet/parser/functions/chop.rb modules/stdlib/lib/puppet/parser/functions/concat.rb modules/stdlib/lib/puppet/parser/functions/deep_merge.rb modules/stdlib/lib/puppet/parser/functions/delete.rb modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb modules/stdlib/lib/puppet/parser/functions/delete_values.rb modules/stdlib/lib/puppet/parser/functions/difference.rb modules/stdlib/lib/puppet/parser/functions/downcase.rb modules/stdlib/lib/puppet/parser/functions/empty.rb modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb modules/stdlib/lib/puppet/parser/functions/floor.rb modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb modules/stdlib/lib/puppet/parser/functions/getvar.rb modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb modules/stdlib/lib/puppet/parser/functions/intersection.rb modules/stdlib/lib/puppet/parser/functions/is_bool.rb modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb modules/stdlib/lib/puppet/parser/functions/is_float.rb modules/stdlib/lib/puppet/parser/functions/is_function_available.rb modules/stdlib/lib/puppet/parser/functions/is_integer.rb modules/stdlib/lib/puppet/parser/functions/is_numeric.rb modules/stdlib/lib/puppet/parser/functions/join.rb modules/stdlib/lib/puppet/parser/functions/lstrip.rb modules/stdlib/lib/puppet/parser/functions/member.rb modules/stdlib/lib/puppet/parser/functions/merge.rb modules/stdlib/lib/puppet/parser/functions/pick.rb modules/stdlib/lib/puppet/parser/functions/pick_default.rb modules/stdlib/lib/puppet/parser/functions/prefix.rb modules/stdlib/lib/puppet/parser/functions/range.rb modules/stdlib/lib/puppet/parser/functions/reverse.rb modules/stdlib/lib/puppet/parser/functions/rstrip.rb modules/stdlib/lib/puppet/parser/functions/shuffle.rb modules/stdlib/lib/puppet/parser/functions/str2bool.rb modules/stdlib/lib/puppet/parser/functions/strip.rb modules/stdlib/lib/puppet/parser/functions/swapcase.rb modules/stdlib/lib/puppet/parser/functions/to_bytes.rb modules/stdlib/lib/puppet/parser/functions/union.rb modules/stdlib/lib/puppet/parser/functions/unique.rb modules/stdlib/lib/puppet/parser/functions/upcase.rb modules/stdlib/lib/puppet/parser/functions/uriescape.rb modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb modules/stdlib/lib/puppet/parser/functions/validate_bool.rb modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb modules/stdlib/lib/puppet/parser/functions/validate_slength.rb modules/stdlib/lib/puppet/parser/functions/validate_string.rb modules/stdlib/lib/puppet/parser/functions/values_at.rb modules/stdlib/lib/puppet/parser/functions/zip.rb modules/stdlib/lib/puppet/provider/file_line/ruby.rb modules/stdlib/lib/puppet/type/file_line.rb modules/stdlib/metadata.json modules/stdlib/spec/acceptance/abs_spec.rb modules/stdlib/spec/acceptance/any2array_spec.rb modules/stdlib/spec/acceptance/base64_spec.rb modules/stdlib/spec/acceptance/bool2num_spec.rb modules/stdlib/spec/acceptance/build_csv.rb modules/stdlib/spec/acceptance/capitalize_spec.rb modules/stdlib/spec/acceptance/chomp_spec.rb modules/stdlib/spec/acceptance/chop_spec.rb modules/stdlib/spec/acceptance/concat_spec.rb modules/stdlib/spec/acceptance/count_spec.rb modules/stdlib/spec/acceptance/deep_merge_spec.rb modules/stdlib/spec/acceptance/defined_with_params_spec.rb modules/stdlib/spec/acceptance/delete_at_spec.rb modules/stdlib/spec/acceptance/delete_spec.rb modules/stdlib/spec/acceptance/delete_undef_values_spec.rb modules/stdlib/spec/acceptance/delete_values_spec.rb modules/stdlib/spec/acceptance/difference_spec.rb modules/stdlib/spec/acceptance/dirname_spec.rb modules/stdlib/spec/acceptance/downcase_spec.rb modules/stdlib/spec/acceptance/empty_spec.rb modules/stdlib/spec/acceptance/ensure_packages_spec.rb modules/stdlib/spec/acceptance/ensure_resource_spec.rb modules/stdlib/spec/acceptance/flatten_spec.rb modules/stdlib/spec/acceptance/floor_spec.rb modules/stdlib/spec/acceptance/fqdn_rotate_spec.rb modules/stdlib/spec/acceptance/get_module_path_spec.rb modules/stdlib/spec/acceptance/getparam_spec.rb modules/stdlib/spec/acceptance/getvar_spec.rb modules/stdlib/spec/acceptance/grep_spec.rb modules/stdlib/spec/acceptance/has_interface_with_spec.rb modules/stdlib/spec/acceptance/has_ip_address_spec.rb modules/stdlib/spec/acceptance/has_ip_network_spec.rb modules/stdlib/spec/acceptance/has_key_spec.rb modules/stdlib/spec/acceptance/hash_spec.rb modules/stdlib/spec/acceptance/intersection_spec.rb modules/stdlib/spec/acceptance/is_array_spec.rb modules/stdlib/spec/acceptance/is_bool_spec.rb modules/stdlib/spec/acceptance/is_domain_name_spec.rb modules/stdlib/spec/acceptance/is_float_spec.rb modules/stdlib/spec/acceptance/is_function_available_spec.rb modules/stdlib/spec/acceptance/is_hash_spec.rb modules/stdlib/spec/acceptance/is_integer_spec.rb modules/stdlib/spec/acceptance/is_ip_address_spec.rb modules/stdlib/spec/acceptance/is_mac_address_spec.rb modules/stdlib/spec/acceptance/is_numeric_spec.rb modules/stdlib/spec/acceptance/is_string_spec.rb modules/stdlib/spec/acceptance/join_keys_to_values_spec.rb modules/stdlib/spec/acceptance/join_spec.rb modules/stdlib/spec/acceptance/keys_spec.rb modules/stdlib/spec/acceptance/loadyaml_spec.rb modules/stdlib/spec/acceptance/lstrip_spec.rb modules/stdlib/spec/acceptance/max_spec.rb modules/stdlib/spec/acceptance/member_spec.rb modules/stdlib/spec/acceptance/merge_spec.rb modules/stdlib/spec/acceptance/min_spec.rb modules/stdlib/spec/acceptance/nodesets/centos-59-x64.yml modules/stdlib/spec/acceptance/nodesets/centos-6-vcloud.yml modules/stdlib/spec/acceptance/nodesets/centos-64-x64-pe.yml modules/stdlib/spec/acceptance/nodesets/centos-64-x64.yml modules/stdlib/spec/acceptance/nodesets/centos-65-x64.yml modules/stdlib/spec/acceptance/nodesets/default.yml modules/stdlib/spec/acceptance/nodesets/fedora-18-x64.yml modules/stdlib/spec/acceptance/nodesets/sles-11-x64.yml modules/stdlib/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml modules/stdlib/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml modules/stdlib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml modules/stdlib/spec/acceptance/nodesets/windows-2003-i386.yml modules/stdlib/spec/acceptance/nodesets/windows-2003-x86_64.yml modules/stdlib/spec/acceptance/nodesets/windows-2008-x86_64.yml modules/stdlib/spec/acceptance/nodesets/windows-2008r2-x86_64.yml modules/stdlib/spec/acceptance/nodesets/windows-2012-x86_64.yml modules/stdlib/spec/acceptance/nodesets/windows-2012r2-x86_64.yml modules/stdlib/spec/acceptance/num2bool_spec.rb modules/stdlib/spec/acceptance/parsejson_spec.rb modules/stdlib/spec/acceptance/parseyaml_spec.rb modules/stdlib/spec/acceptance/pick_default_spec.rb modules/stdlib/spec/acceptance/pick_spec.rb modules/stdlib/spec/acceptance/prefix_spec.rb modules/stdlib/spec/acceptance/range_spec.rb modules/stdlib/spec/acceptance/reject_spec.rb modules/stdlib/spec/acceptance/reverse_spec.rb modules/stdlib/spec/acceptance/rstrip_spec.rb modules/stdlib/spec/acceptance/shuffle_spec.rb modules/stdlib/spec/acceptance/size_spec.rb modules/stdlib/spec/acceptance/sort_spec.rb modules/stdlib/spec/acceptance/squeeze_spec.rb modules/stdlib/spec/acceptance/str2bool_spec.rb modules/stdlib/spec/acceptance/str2saltedsha512_spec.rb modules/stdlib/spec/acceptance/strftime_spec.rb modules/stdlib/spec/acceptance/strip_spec.rb modules/stdlib/spec/acceptance/suffix_spec.rb modules/stdlib/spec/acceptance/swapcase_spec.rb modules/stdlib/spec/acceptance/time_spec.rb modules/stdlib/spec/acceptance/to_bytes_spec.rb modules/stdlib/spec/acceptance/type_spec.rb modules/stdlib/spec/acceptance/union_spec.rb modules/stdlib/spec/acceptance/unique_spec.rb modules/stdlib/spec/acceptance/unsupported_spec.rb modules/stdlib/spec/acceptance/upcase_spec.rb modules/stdlib/spec/acceptance/uriescape_spec.rb modules/stdlib/spec/acceptance/validate_absolute_path_spec.rb modules/stdlib/spec/acceptance/validate_array_spec.rb modules/stdlib/spec/acceptance/validate_augeas_spec.rb modules/stdlib/spec/acceptance/validate_bool_spec.rb modules/stdlib/spec/acceptance/validate_cmd_spec.rb modules/stdlib/spec/acceptance/validate_hash_spec.rb modules/stdlib/spec/acceptance/validate_ipv4_address_spec.rb modules/stdlib/spec/acceptance/validate_ipv6_address_spec.rb modules/stdlib/spec/acceptance/validate_re_spec.rb modules/stdlib/spec/acceptance/validate_slength_spec.rb modules/stdlib/spec/acceptance/validate_string_spec.rb modules/stdlib/spec/acceptance/values_at_spec.rb modules/stdlib/spec/acceptance/values_spec.rb modules/stdlib/spec/acceptance/zip_spec.rb modules/stdlib/spec/classes/anchor_spec.rb modules/stdlib/spec/fixtures/manifests/site.pp modules/stdlib/spec/functions/abs_spec.rb modules/stdlib/spec/functions/any2array_spec.rb modules/stdlib/spec/functions/base64_spec.rb modules/stdlib/spec/functions/bool2num_spec.rb modules/stdlib/spec/functions/capitalize_spec.rb modules/stdlib/spec/functions/chomp_spec.rb modules/stdlib/spec/functions/chop_spec.rb modules/stdlib/spec/functions/concat_spec.rb modules/stdlib/spec/functions/count_spec.rb modules/stdlib/spec/functions/deep_merge_spec.rb modules/stdlib/spec/functions/defined_with_params_spec.rb modules/stdlib/spec/functions/delete_at_spec.rb modules/stdlib/spec/functions/delete_spec.rb modules/stdlib/spec/functions/delete_undef_values_spec.rb modules/stdlib/spec/functions/delete_values_spec.rb modules/stdlib/spec/functions/difference_spec.rb modules/stdlib/spec/functions/dirname_spec.rb modules/stdlib/spec/functions/downcase_spec.rb modules/stdlib/spec/functions/empty_spec.rb modules/stdlib/spec/functions/ensure_packages_spec.rb modules/stdlib/spec/functions/ensure_resource_spec.rb modules/stdlib/spec/functions/flatten_spec.rb modules/stdlib/spec/functions/floor_spec.rb modules/stdlib/spec/functions/fqdn_rotate_spec.rb modules/stdlib/spec/functions/get_module_path_spec.rb modules/stdlib/spec/functions/getparam_spec.rb modules/stdlib/spec/functions/getvar_spec.rb modules/stdlib/spec/functions/grep_spec.rb modules/stdlib/spec/functions/has_interface_with_spec.rb modules/stdlib/spec/functions/has_ip_address_spec.rb modules/stdlib/spec/functions/has_ip_network_spec.rb modules/stdlib/spec/functions/has_key_spec.rb modules/stdlib/spec/functions/hash_spec.rb modules/stdlib/spec/functions/intersection_spec.rb modules/stdlib/spec/functions/is_array_spec.rb modules/stdlib/spec/functions/is_bool_spec.rb modules/stdlib/spec/functions/is_domain_name_spec.rb modules/stdlib/spec/functions/is_float_spec.rb modules/stdlib/spec/functions/is_function_available.rb modules/stdlib/spec/functions/is_hash_spec.rb modules/stdlib/spec/functions/is_integer_spec.rb modules/stdlib/spec/functions/is_ip_address_spec.rb modules/stdlib/spec/functions/is_mac_address_spec.rb modules/stdlib/spec/functions/is_numeric_spec.rb modules/stdlib/spec/functions/is_string_spec.rb modules/stdlib/spec/functions/join_keys_to_values_spec.rb modules/stdlib/spec/functions/join_spec.rb modules/stdlib/spec/functions/keys_spec.rb modules/stdlib/spec/functions/loadyaml_spec.rb modules/stdlib/spec/functions/lstrip_spec.rb modules/stdlib/spec/functions/max_spec.rb modules/stdlib/spec/functions/member_spec.rb modules/stdlib/spec/functions/merge_spec.rb modules/stdlib/spec/functions/min_spec.rb modules/stdlib/spec/functions/num2bool_spec.rb modules/stdlib/spec/functions/parsejson_spec.rb modules/stdlib/spec/functions/parseyaml_spec.rb modules/stdlib/spec/functions/pick_default_spec.rb modules/stdlib/spec/functions/pick_spec.rb modules/stdlib/spec/functions/prefix_spec.rb modules/stdlib/spec/functions/range_spec.rb modules/stdlib/spec/functions/reject_spec.rb modules/stdlib/spec/functions/reverse_spec.rb modules/stdlib/spec/functions/rstrip_spec.rb modules/stdlib/spec/functions/shuffle_spec.rb modules/stdlib/spec/functions/size_spec.rb modules/stdlib/spec/functions/sort_spec.rb modules/stdlib/spec/functions/squeeze_spec.rb modules/stdlib/spec/functions/str2bool_spec.rb modules/stdlib/spec/functions/str2saltedsha512_spec.rb modules/stdlib/spec/functions/strftime_spec.rb modules/stdlib/spec/functions/strip_spec.rb modules/stdlib/spec/functions/suffix_spec.rb modules/stdlib/spec/functions/swapcase_spec.rb modules/stdlib/spec/functions/time_spec.rb modules/stdlib/spec/functions/to_bytes_spec.rb modules/stdlib/spec/functions/type_spec.rb modules/stdlib/spec/functions/union_spec.rb modules/stdlib/spec/functions/unique_spec.rb modules/stdlib/spec/functions/upcase_spec.rb modules/stdlib/spec/functions/uriescape_spec.rb modules/stdlib/spec/functions/validate_absolute_path_spec.rb modules/stdlib/spec/functions/validate_array_spec.rb modules/stdlib/spec/functions/validate_augeas_spec.rb modules/stdlib/spec/functions/validate_bool_spec.rb modules/stdlib/spec/functions/validate_cmd_spec.rb modules/stdlib/spec/functions/validate_hash_spec.rb modules/stdlib/spec/functions/validate_ipv4_address_spec.rb modules/stdlib/spec/functions/validate_ipv6_address_spec.rb modules/stdlib/spec/functions/validate_re_spec.rb modules/stdlib/spec/functions/validate_slength_spec.rb modules/stdlib/spec/functions/validate_string_spec.rb modules/stdlib/spec/functions/values_at_spec.rb modules/stdlib/spec/functions/values_spec.rb modules/stdlib/spec/functions/zip_spec.rb modules/stdlib/spec/lib/puppet_spec/compiler.rb modules/stdlib/spec/lib/puppet_spec/database.rb modules/stdlib/spec/lib/puppet_spec/files.rb modules/stdlib/spec/lib/puppet_spec/fixtures.rb modules/stdlib/spec/lib/puppet_spec/matchers.rb modules/stdlib/spec/lib/puppet_spec/modules.rb modules/stdlib/spec/lib/puppet_spec/pops.rb modules/stdlib/spec/lib/puppet_spec/scope.rb modules/stdlib/spec/lib/puppet_spec/settings.rb modules/stdlib/spec/lib/puppet_spec/verbose.rb modules/stdlib/spec/monkey_patches/alias_should_to_must.rb modules/stdlib/spec/monkey_patches/publicize_methods.rb modules/stdlib/spec/spec_helper.rb modules/stdlib/spec/spec_helper_acceptance.rb modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb modules/stdlib/spec/unit/facter/pe_version_spec.rb modules/stdlib/spec/unit/facter/root_home_spec.rb modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/bool2str_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/camelcase_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb modules/stdlib/spec/unit/puppet/type/anchor_spec.rb modules/stdlib/spec/unit/puppet/type/file_line_spec.rb modules/stdlib/spec/watchr.rb
diffstat 383 files changed, 11338 insertions(+), 4921 deletions(-) [+]
line wrap: on
line diff
--- a/modules/stdlib/CHANGELOG	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,278 +0,0 @@
-2013-05-06 - Jeff McCune <jeff@puppetlabs.com> - 4.1.0
- * (#20582) Restore facter_dot_d to stdlib for PE users (3b887c8)
- * (maint) Update Gemfile with GEM_FACTER_VERSION (f44d535)
-
-2013-05-06 - Alex Cline <acline@us.ibm.com> - 4.1.0
- * Terser method of string to array conversion courtesy of ethooz. (d38bce0)
-
-2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
- * Refactor ensure_resource expectations (b33cc24)
-
-2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
- * Changed str-to-array conversion and removed abbreviation. (de253db)
-
-2013-05-03 - Alex Cline <acline@us.ibm.com> 4.1.0
- * (#20548) Allow an array of resource titles to be passed into the ensure_resource function (e08734a)
-
-2013-05-02 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.1.0
- * Add a dirname function (2ba9e47)
-
-2013-04-29 - Mark Smith-Guerrero <msmithgu@gmail.com> - 4.1.0
- * (maint) Fix a small typo in hash() description (928036a)
-
-2013-04-12 - Jeff McCune <jeff@puppetlabs.com> - 4.0.2
- * Update user information in gemspec to make the intent of the Gem clear.
-
-2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.1
- * Fix README function documentation (ab3e30c)
-
-2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
- * stdlib 4.0 drops support with Puppet 2.7
- * stdlib 4.0 preserves support with Puppet 3
-
-2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
- * Add ability to use puppet from git via bundler (9c5805f)
-
-2013-04-10 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
- * (maint) Make stdlib usable as a Ruby GEM (e81a45e)
-
-2013-04-10 - Erik Dalén <dalen@spotify.com> - 4.0.0
- * Add a count function (f28550e)
-
-2013-03-31 - Amos Shapira <ashapira@atlassian.com> - 4.0.0
- * (#19998) Implement any2array (7a2fb80)
-
-2013-03-29 - Steve Huff <shuff@vecna.org> - 4.0.0
- * (19864) num2bool match fix (8d217f0)
-
-2013-03-20 - Erik Dalén <dalen@spotify.com> - 4.0.0
- * Allow comparisons of Numeric and number as String (ff5dd5d)
-
-2013-03-26 - Richard Soderberg <rsoderberg@mozilla.com> - 4.0.0
- * add suffix function to accompany the prefix function (88a93ac)
-
-2013-03-19 - Kristof Willaert <kristof.willaert@gmail.com> - 4.0.0
- * Add floor function implementation and unit tests (0527341)
-
-2012-04-03 - Eric Shamow <eric@puppetlabs.com> - 4.0.0
- * (#13610) Add is_function_available to stdlib (961dcab)
-
-2012-12-17 - Justin Lambert <jlambert@eml.cc> - 4.0.0
- * str2bool should return a boolean if called with a boolean (5d5a4d4)
-
-2012-10-23 - Uwe Stuehler <ustuehler@team.mobile.de> - 4.0.0
- * Fix number of arguments check in flatten() (e80207b)
-
-2013-03-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
- * Add contributing document (96e19d0)
-
-2013-03-04 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
- * Add missing documentation for validate_augeas and validate_cmd to README.markdown (a1510a1)
-
-2013-02-14 - Joshua Hoblitt <jhoblitt@cpan.org> - 4.0.0
- * (#19272) Add has_element() function (95cf3fe)
-
-2013-02-07 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
- * validate_cmd(): Use Puppet::Util::Execution.execute when available (69248df)
-
-2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
- * Add validate_augeas function (3a97c23)
-
-2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
- * Add validate_cmd function (6902cc5)
-
-2013-01-14 - David Schmitt <david@dasz.at> - 4.0.0
- * Add geppetto project definition (b3fc0a3)
-
-2013-01-02 - Jaka Hudoklin <jakahudoklin@gmail.com> - 4.0.0
- * Add getparam function to get defined resource parameters (20e0e07)
-
-2013-01-05 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
- * (maint) Add Travis CI Support (d082046)
-
-2012-12-04 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
- * Clarify that stdlib 3 supports Puppet 3 (3a6085f)
-
-2012-11-30 - Erik Dalén <dalen@spotify.com> - 4.0.0
- * maint: style guideline fixes (7742e5f)
-
-2012-11-09 - James Fryman <james@frymanet.com> - 4.0.0
- * puppet-lint cleanup (88acc52)
-
-2012-11-06 - Joe Julian <me@joejulian.name> - 4.0.0
- * Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d)
-
-2012-09-18 - Chad Metcalf <chad@wibidata.com> - 3.2.0
- * Add an ensure_packages function. (8a8c09e)
-
-2012-11-23 - Erik Dalén <dalen@spotify.com> - 3.2.0
- * (#17797) min() and max() functions (9954133)
-
-2012-05-23 - Peter Meier <peter.meier@immerda.ch> - 3.2.0
- * (#14670) autorequire a file_line resource's path (dfcee63)
-
-2012-11-19 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
- * Add join_keys_to_values function (ee0f2b3)
-
-2012-11-17 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
- * Extend delete function for strings and hashes (7322e4d)
-
-2012-08-03 - Gary Larizza <gary@puppetlabs.com> - 3.2.0
- * Add the pick() function (ba6dd13)
-
-2012-03-20 - Wil Cooley <wcooley@pdx.edu> - 3.2.0
- * (#13974) Add predicate functions for interface facts (f819417)
-
-2012-11-06 - Joe Julian <me@joejulian.name> - 3.2.0
- * Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e)
-
-2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 3.1.1
- * (maint) Fix spec failures resulting from Facter API changes (97f836f)
-
-2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 3.1.0
- * Add PE facts to stdlib (cdf3b05)
-
-2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.1
- * Fix accidental removal of facts_dot_d.rb in 3.0.0 release
-
-2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.0
- * stdlib 3.0 drops support with Puppet 2.6
- * stdlib 3.0 preserves support with Puppet 2.7
-
-2012-08-07 - Dan Bode <dan@puppetlabs.com> - 3.0.0
- * Add function ensure_resource and defined_with_params (ba789de)
-
-2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 3.0.0
- * (#2157) Remove facter_dot_d for compatibility with external facts (f92574f)
-
-2012-04-10 - Chris Price <chris@puppetlabs.com> - 3.0.0
- * (#13693) moving logic from local spec_helper to puppetlabs_spec_helper (85f96df)
-
-2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 2.5.1
- * (maint) Fix spec failures resulting from Facter API changes (97f836f)
-
-2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 2.5.0
- * Add PE facts to stdlib (cdf3b05)
-
-2012-08-15 - Dan Bode <dan@puppetlabs.com> - 2.5.0
- * Explicitly load functions used by ensure_resource (9fc3063)
-
-2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
- * Add better docs about duplicate resource failures (97d327a)
-
-2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
- * Handle undef for parameter argument (4f8b133)
-
-2012-08-07 - Dan Bode <dan@puppetlabs.com> - 2.5.0
- * Add function ensure_resource and defined_with_params (a0cb8cd)
-
-2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
- * Disable tests that fail on 2.6.x due to #15912 (c81496e)
-
-2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
- * (Maint) Fix mis-use of rvalue functions as statements (4492913)
-
-2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
- * Add .rspec file to repo root (88789e8)
-
-2012-06-07 - Chris Price <chris@puppetlabs.com> - 2.4.0
- * Add support for a 'match' parameter to file_line (a06c0d8)
-
-2012-08-07 - Erik Dalén <dalen@spotify.com> - 2.4.0
- * (#15872) Add to_bytes function (247b69c)
-
-2012-07-19 - Jeff McCune <jeff@puppetlabs.com> - 2.4.0
- * (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) (deafe88)
-
-2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 2.4.0
- * (#2157) Make facts_dot_d compatible with external facts (5fb0ddc)
-
-2012-03-16 - Steve Traylen <steve.traylen@cern.ch> - 2.4.0
- * (#13205) Rotate array/string randomley based on fqdn, fqdn_rotate() (fef247b)
-
-2012-05-22 - Peter Meier <peter.meier@immerda.ch> - 2.3.3
- * fix regression in #11017 properly (f0a62c7)
-
-2012-05-10 - Jeff McCune <jeff@puppetlabs.com> - 2.3.3
- * Fix spec tests using the new spec_helper (7d34333)
-
-2012-05-10 - Puppet Labs <support@puppetlabs.com> - 2.3.2
- * Make file_line default to ensure => present (1373e70)
- * Memoize file_line spec instance variables (20aacc5)
- * Fix spec tests using the new spec_helper (1ebfa5d)
- * (#13595) initialize_everything_for_tests couples modules Puppet ver (3222f35)
- * (#13439) Fix MRI 1.9 issue with spec_helper (15c5fd1)
- * (#13439) Fix test failures with Puppet 2.6.x (665610b)
- * (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca)
- * (#13494) Specify the behavior of zero padded strings (61891bb)
-
-2012-03-29 Puppet Labs <support@puppetlabs.com> - 2.1.3
-* (#11607) Add Rakefile to enable spec testing
-* (#12377) Avoid infinite loop when retrying require json
-
-2012-03-13 Puppet Labs <support@puppetlabs.com> - 2.3.1
-* (#13091) Fix LoadError bug with puppet apply and puppet_vardir fact
-
-2012-03-12 Puppet Labs <support@puppetlabs.com> - 2.3.0
-* Add a large number of new Puppet functions
-* Backwards compatibility preserved with 2.2.x
-
-2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.2.1
-* Documentation only release for the Forge
-
-2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.1.2
-* Documentation only release for PE 2.0.x
-
-2011-11-08 Puppet Labs <support@puppetlabs.com> - 2.2.0
-* #10285 - Refactor json to use pson instead.
-* Maint  - Add watchr autotest script
-* Maint  - Make rspec tests work with Puppet 2.6.4
-* #9859  - Add root_home fact and tests
-
-2011-08-18 Puppet Labs <support@puppetlabs.com> - 2.1.1
-* Change facts.d paths to match Facter 2.0 paths.
-* /etc/facter/facts.d
-* /etc/puppetlabs/facter/facts.d
-
-2011-08-17 Puppet Labs <support@puppetlabs.com> - 2.1.0
-* Add R.I. Pienaar's facts.d custom facter fact
-* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are
-  automatically loaded now.
-
-2011-08-04 Puppet Labs <support@puppetlabs.com> - 2.0.0
-* Rename whole_line to file_line
-* This is an API change and as such motivating a 2.0.0 release according to semver.org.
-
-2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.1.0
-* Rename append_line to whole_line
-* This is an API change and as such motivating a 1.1.0 release.
-
-2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.0.0
-* Initial stable release
-* Add validate_array and validate_string functions
-* Make merge() function work with Ruby 1.8.5
-* Add hash merging function
-* Add has_key function
-* Add loadyaml() function
-* Add append_line native
-
-2011-06-21 Jeff McCune <jeff@puppetlabs.com> - 0.1.7
-* Add validate_hash() and getvar() functions
-
-2011-06-15 Jeff McCune <jeff@puppetlabs.com> - 0.1.6
-* Add anchor resource type to provide containment for composite classes
-
-2011-06-03 Jeff McCune <jeff@puppetlabs.com> - 0.1.5
-* Add validate_bool() function to stdlib
-
-0.1.4 2011-05-26 Jeff McCune <jeff@puppetlabs.com>
-* Move most stages after main
-
-0.1.3 2011-05-25 Jeff McCune <jeff@puppetlabs.com>
-* Add validate_re() function
-
-0.1.2 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
-* Update to add annotated tag
-
-0.1.1 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
-* Add stdlib::stages class with a standard set of stages
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/CHANGELOG.md	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,485 @@
+##2015-01-14 - Supported Release 4.5.1
+###Summary
+
+This release changes the temporary facter_dot_d cache locations outside of the /tmp directory due to a possible security vunerability. CVE-2015-1029
+
+####Bugfixes
+- Facter_dot_d cache will now be stored in puppet libdir instead of tmp
+
+##2014-12-15 - Supported Release 4.5.0
+###Summary
+
+This release improves functionality of the member function and adds improved future parser support.
+
+####Features
+- MODULES-1329: Update member() to allow the variable to be an array.
+- Sync .travis.yml, Gemfile, Rakefile, and CONTRIBUTING.md via modulesync
+
+####Bugfixes
+- Fix range() to work with numeric ranges with the future parser
+- Accurately express SLES support in metadata.json (was missing 10SP4 and 12)
+- Don't require `line` to match the `match` parameter
+
+##2014-11-10 - Supported Release 4.4.0
+###Summary
+This release has an overhauled readme, new private manifest function, and fixes many future parser bugs.
+
+####Features
+- All new shiny README
+- New `private()` function for making private manifests (yay!)
+
+####Bugfixes
+- Code reuse in `bool2num()` and `zip()`
+- Fix many functions to handle `generate()` no longer returning a string on new puppets
+- `concat()` no longer modifies the first argument (whoops)
+- strict variable support for `getvar()`, `member()`, `values_at`, and `has_interface_with()`
+- `to_bytes()` handles PB and EB now
+- Fix `tempfile` ruby requirement for `validate_augeas()` and `validate_cmd()`
+- Fix `validate_cmd()` for windows
+- Correct `validate_string()` docs to reflect non-handling of `undef`
+- Fix `file_line` matching on older rubies
+
+
+##2014-07-15 - Supported Release 4.3.2
+###Summary
+
+This release merely updates metadata.json so the module can be uninstalled and
+upgraded via the puppet module command.
+
+##2014-07-14 - Supported Release 4.3.1
+### Summary
+This supported release updates the metadata.json to work around upgrade behavior of the PMT.
+
+#### Bugfixes
+- Synchronize metadata.json with PMT-generated metadata to pass checksums
+
+##2014-06-27 - Supported Release 4.3.0
+### Summary
+This release is the first supported release of the stdlib 4 series. It remains
+backwards-compatible with the stdlib 3 series. It adds two new functions, one bugfix, and many testing updates.
+
+#### Features
+- New `bool2str()` function
+- New `camalcase()` function
+
+#### Bugfixes
+- Fix `has_interface_with()` when interfaces fact is nil
+
+##2014-06-04 - Release 4.2.2
+### Summary
+
+This release adds PE3.3 support in the metadata and fixes a few tests.
+
+## 2014-05-08 - Release - 4.2.1
+### Summary
+This release moves a stray symlink that can cause problems.
+
+## 2014-05-08 - Release - 4.2.0
+### Summary
+This release adds many new functions and fixes, and continues to be backwards compatible with stdlib 3.x
+
+#### Features
+- New `base64()` function
+- New `deep_merge()` function
+- New `delete_undef_values()` function
+- New `delete_values()` function
+- New `difference()` function
+- New `intersection()` function
+- New `is_bool()` function
+- New `pick_default()` function
+- New `union()` function
+- New `validate_ipv4_address` function
+- New `validate_ipv6_address` function
+- Update `ensure_packages()` to take an option hash as a second parameter.
+- Update `range()` to take an optional third argument for range step
+- Update `validate_slength()` to take an optional third argument for minimum length
+- Update `file_line` resource to take `after` and `multiple` attributes
+
+#### Bugfixes
+- Correct `is_string`, `is_domain_name`, `is_array`, `is_float`, and `is_function_available` for parsing odd types such as bools and hashes.
+- Allow facts.d facts to contain `=` in the value
+- Fix `root_home` fact on darwin systems
+- Fix `concat()` to work with a second non-array argument
+- Fix `floor()` to work with integer strings
+- Fix `is_integer()` to return true if passed integer strings
+- Fix `is_numeric()` to return true if passed integer strings
+- Fix `merge()` to work with empty strings
+- Fix `pick()` to raise the correct error type
+- Fix `uriescape()` to use the default URI.escape list
+- Add/update unit & acceptance tests.
+
+
+##2014-03-04 - Supported Release - 3.2.1
+###Summary
+This is a supported release
+
+####Bugfixes
+- Fixed `is_integer`/`is_float`/`is_numeric` for checking the value of arithmatic expressions.
+
+####Known bugs
+* No known bugs
+
+---
+
+##### 2013-05-06 - Jeff McCune <jeff@puppetlabs.com> - 4.1.0
+
+ * (#20582) Restore facter\_dot\_d to stdlib for PE users (3b887c8)
+ * (maint) Update Gemfile with GEM\_FACTER\_VERSION (f44d535)
+
+##### 2013-05-06 - Alex Cline <acline@us.ibm.com> - 4.1.0
+
+ * Terser method of string to array conversion courtesy of ethooz. (d38bce0)
+
+##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
+
+ * Refactor ensure\_resource expectations (b33cc24)
+
+##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
+
+ * Changed str-to-array conversion and removed abbreviation. (de253db)
+
+##### 2013-05-03 - Alex Cline <acline@us.ibm.com> 4.1.0
+
+ * (#20548) Allow an array of resource titles to be passed into the ensure\_resource function (e08734a)
+
+##### 2013-05-02 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.1.0
+
+ * Add a dirname function (2ba9e47)
+
+##### 2013-04-29 - Mark Smith-Guerrero <msmithgu@gmail.com> - 4.1.0
+
+ * (maint) Fix a small typo in hash() description (928036a)
+
+##### 2013-04-12 - Jeff McCune <jeff@puppetlabs.com> - 4.0.2
+
+ * Update user information in gemspec to make the intent of the Gem clear.
+
+##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.1
+
+ * Fix README function documentation (ab3e30c)
+
+##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * stdlib 4.0 drops support with Puppet 2.7
+ * stdlib 4.0 preserves support with Puppet 3
+
+##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * Add ability to use puppet from git via bundler (9c5805f)
+
+##### 2013-04-10 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * (maint) Make stdlib usable as a Ruby GEM (e81a45e)
+
+##### 2013-04-10 - Erik Dalén <dalen@spotify.com> - 4.0.0
+
+ * Add a count function (f28550e)
+
+##### 2013-03-31 - Amos Shapira <ashapira@atlassian.com> - 4.0.0
+
+ * (#19998) Implement any2array (7a2fb80)
+
+##### 2013-03-29 - Steve Huff <shuff@vecna.org> - 4.0.0
+
+ * (19864) num2bool match fix (8d217f0)
+
+##### 2013-03-20 - Erik Dalén <dalen@spotify.com> - 4.0.0
+
+ * Allow comparisons of Numeric and number as String (ff5dd5d)
+
+##### 2013-03-26 - Richard Soderberg <rsoderberg@mozilla.com> - 4.0.0
+
+ * add suffix function to accompany the prefix function (88a93ac)
+
+##### 2013-03-19 - Kristof Willaert <kristof.willaert@gmail.com> - 4.0.0
+
+ * Add floor function implementation and unit tests (0527341)
+
+##### 2012-04-03 - Eric Shamow <eric@puppetlabs.com> - 4.0.0
+
+ * (#13610) Add is\_function\_available to stdlib (961dcab)
+
+##### 2012-12-17 - Justin Lambert <jlambert@eml.cc> - 4.0.0
+
+ * str2bool should return a boolean if called with a boolean (5d5a4d4)
+
+##### 2012-10-23 - Uwe Stuehler <ustuehler@team.mobile.de> - 4.0.0
+
+ * Fix number of arguments check in flatten() (e80207b)
+
+##### 2013-03-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * Add contributing document (96e19d0)
+
+##### 2013-03-04 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
+
+ * Add missing documentation for validate\_augeas and validate\_cmd to README.markdown (a1510a1)
+
+##### 2013-02-14 - Joshua Hoblitt <jhoblitt@cpan.org> - 4.0.0
+
+ * (#19272) Add has\_element() function (95cf3fe)
+
+##### 2013-02-07 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
+
+ * validate\_cmd(): Use Puppet::Util::Execution.execute when available (69248df)
+
+##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
+
+ * Add validate\_augeas function (3a97c23)
+
+##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
+
+ * Add validate\_cmd function (6902cc5)
+
+##### 2013-01-14 - David Schmitt <david@dasz.at> - 4.0.0
+
+ * Add geppetto project definition (b3fc0a3)
+
+##### 2013-01-02 - Jaka Hudoklin <jakahudoklin@gmail.com> - 4.0.0
+
+ * Add getparam function to get defined resource parameters (20e0e07)
+
+##### 2013-01-05 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * (maint) Add Travis CI Support (d082046)
+
+##### 2012-12-04 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * Clarify that stdlib 3 supports Puppet 3 (3a6085f)
+
+##### 2012-11-30 - Erik Dalén <dalen@spotify.com> - 4.0.0
+
+ * maint: style guideline fixes (7742e5f)
+
+##### 2012-11-09 - James Fryman <james@frymanet.com> - 4.0.0
+
+ * puppet-lint cleanup (88acc52)
+
+##### 2012-11-06 - Joe Julian <me@joejulian.name> - 4.0.0
+
+ * Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d)
+
+##### 2012-09-18 - Chad Metcalf <chad@wibidata.com> - 3.2.0
+
+ * Add an ensure\_packages function. (8a8c09e)
+
+##### 2012-11-23 - Erik Dalén <dalen@spotify.com> - 3.2.0
+
+ * (#17797) min() and max() functions (9954133)
+
+##### 2012-05-23 - Peter Meier <peter.meier@immerda.ch> - 3.2.0
+
+ * (#14670) autorequire a file\_line resource's path (dfcee63)
+
+##### 2012-11-19 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
+
+ * Add join\_keys\_to\_values function (ee0f2b3)
+
+##### 2012-11-17 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
+
+ * Extend delete function for strings and hashes (7322e4d)
+
+##### 2012-08-03 - Gary Larizza <gary@puppetlabs.com> - 3.2.0
+
+ * Add the pick() function (ba6dd13)
+
+##### 2012-03-20 - Wil Cooley <wcooley@pdx.edu> - 3.2.0
+
+ * (#13974) Add predicate functions for interface facts (f819417)
+
+##### 2012-11-06 - Joe Julian <me@joejulian.name> - 3.2.0
+
+ * Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e)
+
+##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 3.1.1
+
+ * (maint) Fix spec failures resulting from Facter API changes (97f836f)
+
+##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 3.1.0
+
+ * Add PE facts to stdlib (cdf3b05)
+
+##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.1
+
+ * Fix accidental removal of facts\_dot\_d.rb in 3.0.0 release
+
+##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.0
+
+ * stdlib 3.0 drops support with Puppet 2.6
+ * stdlib 3.0 preserves support with Puppet 2.7
+
+##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 3.0.0
+
+ * Add function ensure\_resource and defined\_with\_params (ba789de)
+
+##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 3.0.0
+
+ * (#2157) Remove facter\_dot\_d for compatibility with external facts (f92574f)
+
+##### 2012-04-10 - Chris Price <chris@puppetlabs.com> - 3.0.0
+
+ * (#13693) moving logic from local spec\_helper to puppetlabs\_spec\_helper (85f96df)
+
+##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 2.5.1
+
+ * (maint) Fix spec failures resulting from Facter API changes (97f836f)
+
+##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 2.5.0
+
+ * Add PE facts to stdlib (cdf3b05)
+
+##### 2012-08-15 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Explicitly load functions used by ensure\_resource (9fc3063)
+
+##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Add better docs about duplicate resource failures (97d327a)
+
+##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Handle undef for parameter argument (4f8b133)
+
+##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Add function ensure\_resource and defined\_with\_params (a0cb8cd)
+
+##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
+
+ * Disable tests that fail on 2.6.x due to #15912 (c81496e)
+
+##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
+
+ * (Maint) Fix mis-use of rvalue functions as statements (4492913)
+
+##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
+
+ * Add .rspec file to repo root (88789e8)
+
+##### 2012-06-07 - Chris Price <chris@puppetlabs.com> - 2.4.0
+
+ * Add support for a 'match' parameter to file\_line (a06c0d8)
+
+##### 2012-08-07 - Erik Dalén <dalen@spotify.com> - 2.4.0
+
+ * (#15872) Add to\_bytes function (247b69c)
+
+##### 2012-07-19 - Jeff McCune <jeff@puppetlabs.com> - 2.4.0
+
+ * (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) (deafe88)
+
+##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 2.4.0
+
+ * (#2157) Make facts\_dot\_d compatible with external facts (5fb0ddc)
+
+##### 2012-03-16 - Steve Traylen <steve.traylen@cern.ch> - 2.4.0
+
+ * (#13205) Rotate array/string randomley based on fqdn, fqdn\_rotate() (fef247b)
+
+##### 2012-05-22 - Peter Meier <peter.meier@immerda.ch> - 2.3.3
+
+ * fix regression in #11017 properly (f0a62c7)
+
+##### 2012-05-10 - Jeff McCune <jeff@puppetlabs.com> - 2.3.3
+
+ * Fix spec tests using the new spec\_helper (7d34333)
+
+##### 2012-05-10 - Puppet Labs <support@puppetlabs.com> - 2.3.2
+
+ * Make file\_line default to ensure => present (1373e70)
+ * Memoize file\_line spec instance variables (20aacc5)
+ * Fix spec tests using the new spec\_helper (1ebfa5d)
+ * (#13595) initialize\_everything\_for\_tests couples modules Puppet ver (3222f35)
+ * (#13439) Fix MRI 1.9 issue with spec\_helper (15c5fd1)
+ * (#13439) Fix test failures with Puppet 2.6.x (665610b)
+ * (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca)
+ * (#13494) Specify the behavior of zero padded strings (61891bb)
+
+##### 2012-03-29 Puppet Labs <support@puppetlabs.com> - 2.1.3
+
+* (#11607) Add Rakefile to enable spec testing
+* (#12377) Avoid infinite loop when retrying require json
+
+##### 2012-03-13 Puppet Labs <support@puppetlabs.com> - 2.3.1
+
+* (#13091) Fix LoadError bug with puppet apply and puppet\_vardir fact
+
+##### 2012-03-12 Puppet Labs <support@puppetlabs.com> - 2.3.0
+
+* Add a large number of new Puppet functions
+* Backwards compatibility preserved with 2.2.x
+
+##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.2.1
+
+* Documentation only release for the Forge
+
+##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.1.2
+
+* Documentation only release for PE 2.0.x
+
+##### 2011-11-08 Puppet Labs <support@puppetlabs.com> - 2.2.0
+
+* #10285 - Refactor json to use pson instead.
+* Maint  - Add watchr autotest script
+* Maint  - Make rspec tests work with Puppet 2.6.4
+* #9859  - Add root\_home fact and tests
+
+##### 2011-08-18 Puppet Labs <support@puppetlabs.com> - 2.1.1
+
+* Change facts.d paths to match Facter 2.0 paths.
+* /etc/facter/facts.d
+* /etc/puppetlabs/facter/facts.d
+
+##### 2011-08-17 Puppet Labs <support@puppetlabs.com> - 2.1.0
+
+* Add R.I. Pienaar's facts.d custom facter fact
+* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are
+  automatically loaded now.
+
+##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 2.0.0
+
+* Rename whole\_line to file\_line
+* This is an API change and as such motivating a 2.0.0 release according to semver.org.
+
+##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.1.0
+
+* Rename append\_line to whole\_line
+* This is an API change and as such motivating a 1.1.0 release.
+
+##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.0.0
+
+* Initial stable release
+* Add validate\_array and validate\_string functions
+* Make merge() function work with Ruby 1.8.5
+* Add hash merging function
+* Add has\_key function
+* Add loadyaml() function
+* Add append\_line native
+
+##### 2011-06-21 Jeff McCune <jeff@puppetlabs.com> - 0.1.7
+
+* Add validate\_hash() and getvar() functions
+
+##### 2011-06-15 Jeff McCune <jeff@puppetlabs.com> - 0.1.6
+
+* Add anchor resource type to provide containment for composite classes
+
+##### 2011-06-03 Jeff McCune <jeff@puppetlabs.com> - 0.1.5
+
+* Add validate\_bool() function to stdlib
+
+##### 0.1.4 2011-05-26 Jeff McCune <jeff@puppetlabs.com>
+
+* Move most stages after main
+
+##### 0.1.3 2011-05-25 Jeff McCune <jeff@puppetlabs.com>
+
+* Add validate\_re() function
+
+##### 0.1.2 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
+
+* Update to add annotated tag
+
+##### 0.1.1 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
+
+* Add stdlib::stages class with a standard set of stages
--- a/modules/stdlib/CONTRIBUTING.md	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/CONTRIBUTING.md	Sat Mar 14 20:09:45 2015 +0000
@@ -1,65 +1,220 @@
-# How to contribute
+Checklist (and a short version for the impatient)
+=================================================
+
+  * Commits:
+
+    - Make commits of logical units.
+
+    - Check for unnecessary whitespace with "git diff --check" before
+      committing.
+
+    - Commit using Unix line endings (check the settings around "crlf" in
+      git-config(1)).
+
+    - Do not check in commented out code or unneeded files.
+
+    - The first line of the commit message should be a short
+      description (50 characters is the soft limit, excluding ticket
+      number(s)), and should skip the full stop.
+
+    - Associate the issue in the message. The first line should include
+      the issue number in the form "(#XXXX) Rest of message".
+
+    - The body should provide a meaningful commit message, which:
 
-Third-party patches are essential for keeping stdlib great. We simply can't
-access the huge number of platforms and myriad configurations for running
-stdlib. We want to keep it as easy as possible to contribute changes that
-get things working in your environment. There are a few guidelines that we
-need contributors to follow so that we can have a chance of keeping on
-top of things.
+      - uses the imperative, present tense: "change", not "changed" or
+        "changes".
+
+      - includes motivation for the change, and contrasts its
+        implementation with the previous behavior.
+
+    - Make sure that you have tests for the bug you are fixing, or
+      feature you are adding.
+
+    - Make sure the test suites passes after your commit:
+      `bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
 
-## Getting Started
+    - When introducing a new feature, make sure it is properly
+      documented in the README.md
+
+  * Submission:
+
+    * Pre-requisites:
+
+      - Make sure you have a [GitHub account](https://github.com/join)
+
+      - [Create a ticket](https://tickets.puppetlabs.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppetlabs.com/browse/) you are patching for.
+
+    * Preferred method:
+
+      - Fork the repository on GitHub.
 
-* Make sure you have a [Redmine account](http://projects.puppetlabs.com)
-* Make sure you have a [GitHub account](https://github.com/signup/free)
-* Submit a ticket for your issue, assuming one does not already exist.
-  * Clearly describe the issue including steps to reproduce when it is a bug.
-  * Make sure you fill in the earliest version that you know has the issue.
-* Fork the repository on GitHub
+      - Push your changes to a topic branch in your fork of the
+        repository. (the format ticket/1234-short_description_of_change is
+        usually preferred for this project).
+
+      - Submit a pull request to the repository in the puppetlabs
+        organization.
+
+The long version
+================
+
+  1.  Make separate commits for logically separate changes.
 
-## Making Changes
+      Please break your commits down into logically consistent units
+      which include new or changed tests relevant to the rest of the
+      change.  The goal of doing this is to make the diff easier to
+      read for whoever is reviewing your code.  In general, the easier
+      your diff is to read, the more likely someone will be happy to
+      review it and get it into the code base.
+
+      If you are going to refactor a piece of code, please do so as a
+      separate commit from your feature or bug fix changes.
+
+      We also really appreciate changes that include tests to make
+      sure the bug is not re-introduced, and that the feature is not
+      accidentally broken.
 
-* Create a topic branch from where you want to base your work.
-  * This is usually the master branch.
-  * Only target release branches if you are certain your fix must be on that
-    branch.
-  * To quickly create a topic branch based on master; `git branch
-    fix/master/my_contribution master` then checkout the new branch with `git
-    checkout fix/master/my_contribution`.  Please avoid working directly on the
-    `master` branch.
-* Make commits of logical units.
-* Check for unnecessary whitespace with `git diff --check` before committing.
-* Make sure your commit messages are in the proper format.
+      Describe the technical detail of the change(s).  If your
+      description starts to get too long, that is a good sign that you
+      probably need to split up your commit into more finely grained
+      pieces.
+
+      Commits which plainly describe the things which help
+      reviewers check the patch and future developers understand the
+      code are much more likely to be merged in with a minimum of
+      bike-shedding or requested changes.  Ideally, the commit message
+      would include information, and be in a form suitable for
+      inclusion in the release notes for the version of Puppet that
+      includes them.
+
+      Please also check that you are not introducing any trailing
+      whitespace or other "whitespace errors".  You can do this by
+      running "git diff --check" on your changes before you commit.
+
+  2.  Sending your patches
+
+      To submit your changes via a GitHub pull request, we _highly_
+      recommend that you have them on a topic branch, instead of
+      directly on "master".
+      It makes things much easier to keep track of, especially if
+      you decide to work on another thing before your first change
+      is merged in.
+
+      GitHub has some pretty good
+      [general documentation](http://help.github.com/) on using
+      their site.  They also have documentation on
+      [creating pull requests](http://help.github.com/send-pull-requests/).
 
-````
-    (#99999) Make the example in CONTRIBUTING imperative and concrete
+      In general, after pushing your topic branch up to your
+      repository on GitHub, you can switch to the branch in the
+      GitHub UI and click "Pull Request" towards the top of the page
+      in order to open a pull request.
+
+
+  3.  Update the related GitHub issue.
+
+      If there is a GitHub issue associated with the change you
+      submitted, then you should update the ticket to include the
+      location of your branch, along with any other commentary you
+      may wish to make.
+
+Testing
+=======
+
+Getting Started
+---------------
+
+Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
+package manager such as [bundler](http://bundler.io/) what Ruby packages,
+or Gems, are required to build, develop, and test this software.
+
+Please make sure you have [bundler installed](http://bundler.io/#getting-started)
+on your system, then use it to install all dependencies needed for this project,
+by running
 
-    Without this patch applied the example commit message in the CONTRIBUTING
-    document is not a concrete example.  This is a problem because the
-    contributor is left to imagine what the commit message should look like
-    based on a description rather than an example.  This patch fixes the
-    problem by making the example concrete and imperative.
+```shell
+% bundle install
+Fetching gem metadata from https://rubygems.org/........
+Fetching gem metadata from https://rubygems.org/..
+Using rake (10.1.0)
+Using builder (3.2.2)
+-- 8><-- many more --><8 --
+Using rspec-system-puppet (2.2.0)
+Using serverspec (0.6.3)
+Using rspec-system-serverspec (1.0.0)
+Using bundler (1.3.5)
+Your bundle is complete!
+Use `bundle show [gemname]` to see where a bundled gem is installed.
+```
 
-    The first line is a real life imperative statement with a ticket number
-    from our issue tracker.  The body describes the behavior without the patch,
-    why this is a problem, and how the patch fixes the problem when applied.
-````
+NOTE some systems may require you to run this command with sudo.
+
+If you already have those gems installed, make sure they are up-to-date:
 
-* Make sure you have added the necessary tests for your changes.
-* Run _all_ the tests to assure nothing else was accidentally broken.
+```shell
+% bundle update
+```
+
+With all dependencies in place and up-to-date we can now run the tests:
+
+```shell
+% rake spec
+```
 
-## Submitting Changes
+This will execute all the [rspec tests](http://rspec-puppet.com/) tests
+under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
+and so on. rspec tests may have the same kind of dependencies as the
+module they are testing. While the module defines in its [Modulefile](./Modulefile),
+rspec tests define them in [.fixtures.yml](./fixtures.yml).
+
+Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker)
+tests. These tests spin up a virtual machine under
+[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
+[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
+scenarios. In order to run these, you will need both of those tools
+installed on your system.
 
-* Sign the [Contributor License Agreement](http://links.puppetlabs.com/cla).
-* Push your changes to a topic branch in your fork of the repository.
-* Submit a pull request to the repository in the puppetlabs organization.
-* Update your Redmine ticket to mark that you have submitted code and are ready for it to be reviewed.
-  * Include a link to the pull request in the ticket
+You can run them by issuing the following command
+
+```shell
+% rake spec_clean
+% rspec spec/acceptance
+```
+
+This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
+install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
+and then run all the tests under [spec/acceptance](./spec/acceptance).
+
+Writing Tests
+-------------
 
-# Additional Resources
+XXX getting started writing tests.
+
+If you have commit access to the repository
+===========================================
+
+Even if you have commit access to the repository, you will still need to
+go through the process above, and have someone else review and merge
+in your changes.  The rule is that all changes must be reviewed by a
+developer on the project (that did not write the code) to ensure that
+all changes go through a code review process.
+
+Having someone other than the author of the topic branch recorded as
+performing the merge is the record that they performed the code
+review.
 
-* [More information on contributing](http://links.puppetlabs.com/contribute-to-puppet)
-* [Bug tracker (Redmine)](http://projects.puppetlabs.com)
-* [Contributor License Agreement](http://links.puppetlabs.com/cla)
+
+Additional Resources
+====================
+
+* [Getting additional help](http://puppetlabs.com/community/get-help)
+
+* [Writing tests](http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests)
+
+* [Patchwork](https://patchwork.puppetlabs.com)
+
 * [General GitHub documentation](http://help.github.com/)
+
 * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
-* #puppet-dev IRC channel on freenode.org
+
--- a/modules/stdlib/Gemfile	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/Gemfile	Sat Mar 14 20:09:45 2015 +0000
@@ -1,34 +1,27 @@
-source "https://rubygems.org"
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
 
 def location_for(place, fake_version = nil)
-  mdata = /^(git:[^#]*)#(.*)/.match(place)
-  if mdata
-    [fake_version, { :git => mdata[1], :branch => mdata[2], :require => false }].compact
+  if place =~ /^(git[:@][^#]*)#(.*)/
+    [fake_version, { :git => $1, :branch => $2, :require => false }].compact
   elsif place =~ /^file:\/\/(.*)/
-    ['>= 0', { :path => File.expand_path(mdata[1]), :require => false }]
+    ['>= 0', { :path => File.expand_path($1), :require => false }]
   else
     [place, { :require => false }]
   end
 end
 
-group :development do
-  gem 'watchr'
+group :development, :unit_tests do
+  gem 'rake', '~> 10.1.0',       :require => false
+  gem 'rspec-puppet',            :require => false
+  gem 'puppetlabs_spec_helper',  :require => false
+  gem 'puppet-lint',             :require => false
+  gem 'pry',                     :require => false
+  gem 'simplecov',               :require => false
 end
 
-group :development, :test do
-  gem 'rake'
-  gem 'puppetmodule-stdlib', ">= 1.0.0", :path => File.expand_path("..", __FILE__)
-  gem 'rspec', "~> 2.11.0", :require => false
-  gem 'mocha', "~> 0.10.5", :require => false
-  gem 'puppetlabs_spec_helper', :require => false
-  gem 'rspec-puppet', :require => false
-end
-
-facterversion = ENV['GEM_FACTER_VERSION']
-if facterversion
-  gem 'facter', *location_for(facterversion)
-else
-  gem 'facter', :require => false
+group :system_tests do
+  gem 'beaker-rspec',            :require => false
+  gem 'serverspec',              :require => false
 end
 
 ENV['GEM_PUPPET_VERSION'] ||= ENV['PUPPET_GEM_VERSION']
--- a/modules/stdlib/Modulefile	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-name    'puppetlabs-stdlib'
-version '4.1.0'
-source 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
-author 'puppetlabs'
-license 'Apache 2.0'
-summary 'Puppet Module Standard Library'
-description 'Standard Library for Puppet Modules'
-project_page 'https://github.com/puppetlabs/puppetlabs-stdlib'
-
-## Add dependencies, if any:
-# dependency 'username/name', '>= 1.2.0'
--- a/modules/stdlib/README.markdown	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/README.markdown	Sat Mar 14 20:09:45 2015 +0000
@@ -1,9 +1,25 @@
-# Puppet Labs Standard Library #
+#stdlib
 
 [![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-stdlib.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-stdlib)
 
-This module provides a "standard library" of resources for developing Puppet
-Modules.  This modules will include the following additions to Puppet
+####Table of Contents
+
+1. [Overview](#overview)
+2. [Module Description - What the module does and why it is useful](#module-description)
+3. [Setup - The basics of getting started with stdlib](#setup)
+4. [Usage - Configuration options and additional functionality](#usage)
+5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
+5. [Limitations - OS compatibility, etc.](#limitations)
+6. [Development - Guide for contributing to the module](#development)
+
+##Overview
+
+Adds a standard library of resources for Puppet modules.    
+
+##Module Description
+
+This module provides a standard library of resources for the development of Puppet
+modules. Puppet modules make heavy use of this standard library. The stdlib module adds the following resources to Puppet:
 
  * Stages
  * Facts
@@ -11,1184 +27,689 @@
  * Defined resource types
  * Types
  * Providers
+ 
+> *Note:* As of version 3.7, Puppet Enterprise no longer includes the stdlib module. If you're running Puppet Enterprise, you should install the most recent release of stdlib for compatibility with Puppet modules.
 
-This module is officially curated and provided by Puppet Labs.  The modules
-Puppet Labs writes and distributes will make heavy use of this standard
-library.
+##Setup
+
+Installing the stdlib module adds the functions, facts, and resources of this standard library to Puppet. 
+
+##Usage
 
-To report or research a bug with any part of this module, please go to
-[http://projects.puppetlabs.com/projects/stdlib](http://projects.puppetlabs.com/projects/stdlib)
+After you've installed stdlib, all of its functions, facts, and resources are available for module use or development. 
+
+If you want to use a standardized set of run stages for Puppet, `include stdlib` in your manifest. 
+
+## Reference
 
-# Versions #
+### Classes 
+
+#### Public Classes
+
+* `stdlib`: Most of stdlib's features are automatically loaded by Puppet. To use standardized run stages in Puppet, declare this class in your manifest with `include stdlib`.
+
+  When declared, stdlib declares all other classes in the module. The only other class currently included in the module is `stdlib::stages`.
 
-This module follows semver.org (v1.0.0) versioning guidelines.  The standard
-library module is released as part of [Puppet
-Enterprise](http://puppetlabs.com/puppet/puppet-enterprise/) and as a result
-older versions of Puppet Enterprise that Puppet Labs still supports will have
-bugfix maintenance branches periodically "merged up" into master.  The current
-list of integration branches are:
+  The stdlib class has no parameters.
+
+#### Private Classes
+
+* `stdlib::stages`: This class manages a standard set of run stages for Puppet. It is managed by the stdlib class and should not be declared independently.
+
+  The `stdlib::stages` class declares various run stages for deploying infrastructure, language runtimes, and application layers. The high level stages are (in order):
 
- * v2.1.x (v2.1.1 released in PE 1)
- * v2.2.x (Never released as part of PE, only to the Forge)
- * v2.3.x (Released in PE 2)
- * v3.0.x (Never released as part of PE, only to the Forge)
- * v4.0.x (Drops support for Puppet 2.7)
- * master (mainline development branch)
+  * setup
+  * main
+  * runtime
+  * setup_infra
+  * deploy_infra
+  * setup_app
+  * deploy_app
+  * deploy
 
-The first Puppet Enterprise version including the stdlib module is Puppet
-Enterprise 1.2.
+  Sample usage:
 
-# Compatibility #
+  ```
+  node default {
+    include stdlib
+    class { java: stage => 'runtime' }
+  }
+  ```
+  
+### Resources
 
-Puppet Versions | < 2.6 | 2.6 | 2.7 | 3.x |
-:---------------|:-----:|:---:|:---:|:----:
-**stdlib 2.x**  | no    | **yes** | **yes** | no
-**stdlib 3.x**  | no    | no  | **yes** | **yes**
-**stdlib 4.x**  | no    | no  | no  | **yes**
+* `file_line`: This resource ensures that a given line, including whitespace at the beginning and end, is contained within a file. If the line is not contained in the given file, Puppet will add the line. Multiple resources can be declared to manage multiple lines in the same file. You can also use match to replace existing lines. 
+ 
+  ```
+  file_line { 'sudo_rule':
+    path => '/etc/sudoers',
+    line => '%sudo ALL=(ALL) ALL',
+  }
+  file_line { 'sudo_rule_nopw':
+    path => '/etc/sudoers',
+    line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
+  }
+  ```
+  
+  * `after`: Specify the line after which Puppet will add any new lines. (Existing lines are added in place.) Optional.
+  * `ensure`: Ensures whether the resource is present. Valid values are 'present', 'absent'.
+ * `line`: The line to be added to the file located by the `path` parameter.
+ * `match`: A regular expression to run against existing lines in the file; if a match is found, we replace that line rather than adding a new line. Optional.
+ * `multiple`: Determine if match can change multiple lines. Valid values are 'true', 'false'. Optional.
+ * `name`: An arbitrary name used as the identity of the resource.
+ * `path`: The file in which Puppet will ensure the line specified by the line parameter.
+  
+### Functions
 
-The stdlib module does not work with Puppet versions released prior to Puppet
-2.6.0.
+* `abs`: Returns the absolute value of a number; for example, '-34.56' becomes '34.56'. Takes a single integer and float value as an argument. *Type*: rvalue
 
-## stdlib 2.x ##
-
-All stdlib releases in the 2.0 major version support Puppet 2.6 and Puppet 2.7.
-
-## stdlib 3.x ##
+* `any2array`: This converts any object to an array containing that object. Empty argument lists are converted to an empty array. Arrays are left untouched. Hashes are converted to arrays of alternating keys and values. *Type*: rvalue
 
-The 3.0 major release of stdlib drops support for Puppet 2.6.  Stdlib 3.x
-supports Puppet 2 and Puppet 3.
+* `base64`: Converts a string to and from base64 encoding.
+Requires an action ('encode', 'decode') and either a plain or base64-encoded
+string. *Type*: rvalue
+
+* `bool2num`: Converts a boolean to a number. Converts values:
+  * 'false', 'f', '0', 'n', and 'no' to 0.
+  * 'true', 't', '1', 'y', and 'yes' to 1.
+  Requires a single boolean or string as an input. *Type*: rvalue
 
-## stdlib 4.x ##
+* `capitalize`: Capitalizes the first letter of a string or array of strings.
+Requires either a single string or an array as an input. *Type*: rvalue
 
-The 4.0 major release of stdlib drops support for Puppet 2.7.  Stdlib 4.x
-supports Puppet 3.  Notably, ruby 1.8.5 is no longer supported though ruby
-1.8.7, 1.9.3, and 2.0.0 are fully supported.
+* `chomp`: Removes the record separator from the end of a string or an array of
+strings; for example, 'hello\n' becomes 'hello'. Requires a single string or array as an input. *Type*: rvalue
+
+* `chop`: Returns a new string with the last character removed. If the string ends with '\r\n', both characters are removed. Applying `chop` to an empty string returns an empty string. If you want to merely remove record separators, then you should use the `chomp` function. Requires a string or an array of strings as input. *Type*: rvalue
+
+* `concat`: Appends the contents of array 2 onto array 1. For example, `concat(['1','2','3'],'4')` results in: ['1','2','3','4']. *Type*: rvalue
 
-# Functions #
+* `count`: Takes an array as first argument and an optional second argument. Count the number of elements in array that matches second argument. If called with only an array, it counts the number of elements that are **not** nil/undef. *Type*: rvalue
+
+* `defined_with_params`: Takes a resource reference and an optional hash of attributes. Returns 'true' if a resource with the specified attributes has already been added to the catalog. Returns 'false' otherwise.
+
+  ```
+  user { 'dan':
+    ensure => present,
+  }
 
-abs
----
-Returns the absolute value of a number, for example -34.56 becomes
-34.56. Takes a single integer and float value as an argument.
+  if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
+    user { 'dan': ensure => present, }
+  }
+  ```
+  
+  *Type*: rvalue
 
+* `delete`: Deletes all instances of a given element from an array, substring from a
+string, or key from a hash. For example, `delete(['a','b','c','b'], 'b')` returns ['a','c']; `delete('abracadabra', 'bra')` returns 'acada'. *Type*: rvalue
 
-- *Type*: rvalue
+* `delete_at`: Deletes a determined indexed value from an array. For example, `delete_at(['a','b','c'], 1)` returns ['a','c']. *Type*: rvalue
 
-any2array
----------
-This converts any object to an array containing that object. Empty argument
-lists are converted to an empty array. Arrays are left untouched. Hashes are
-converted to arrays of alternating keys and values.
+* `delete_values`: Deletes all instances of a given value from a hash. For example, `delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')` returns {'a'=>'A','c'=>'C','B'=>'D'} *Type*: rvalue
+
+* `delete_undef_values`: Deletes all instances of the undef value from an array or hash. For example, `$hash = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})` returns {a => 'A', b => '', d => false}. *Type*: rvalue
+
+* `difference`: Returns the difference between two arrays.
+The returned array is a copy of the original array, removing any items that
+also appear in the second array. For example, `difference(["a","b","c"],["b","c","d"])` returns ["a"].
 
+* `dirname`: Returns the `dirname` of a path. For example, `dirname('/path/to/a/file.ext')` returns '/path/to/a'.
 
-- *Type*: rvalue
+* `downcase`: Converts the case of a string or of all strings in an array to lowercase. *Type*: rvalue
+
+* `empty`: Returns 'true' if the variable is empty. *Type*: rvalue
+
+* `ensure_packages`: Takes a list of packages and only installs them if they don't already exist. It optionally takes a hash as a second parameter to be passed as the third argument to the `ensure_resource()` function. *Type*: statement
+
+* `ensure_resource`: Takes a resource type, title, and a list of attributes that describe a resource.
 
-bool2num
---------
-Converts a boolean to a number. Converts the values:
-false, f, 0, n, and no to 0
-true, t, 1, y, and yes to 1
-    Requires a single boolean or string as an input.
+  ```
+  user { 'dan':
+    ensure => present,
+  }
+  ```
 
+  This example only creates the resource if it does not already exist:
+
+    `ensure_resource('user', 'dan', {'ensure' => 'present' })`
+
+  If the resource already exists, but does not match the specified parameters, this function attempts to recreate the resource, leading to a duplicate resource definition error.
 
-- *Type*: rvalue
+  An array of resources can also be passed in, and each will be created with the type and parameters specified if it doesn't already exist.
+
+  `ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})`
+
+  *Type*: statement
 
-capitalize
-----------
-Capitalizes the first letter of a string or array of strings.
-Requires either a single string or an array as an input.
+* `flatten`: This function flattens any deeply nested arrays and returns a single flat array as a result. For example, `flatten(['a', ['b', ['c']]])` returns ['a','b','c']. *Type*: rvalue
 
+* `floor`: Returns the largest integer less than or equal to the argument.
+Takes a single numeric value as an argument. *Type*: rvalue
 
-- *Type*: rvalue
+* `fqdn_rotate`: Rotates an array a random number of times based on a node's fqdn. *Type*: rvalue
 
-chomp
------
-Removes the record separator from the end of a string or an array of
-strings, for example `hello\n` becomes `hello`.
-Requires a single string or array as an input.
+* `get_module_path`: Returns the absolute path of the specified module for the current environment.
+
+  `$module_path = get_module_path('stdlib')`
+
+  *Type*: rvalue
 
+* `getparam`: Takes a resource reference and the name of the parameter and
+returns the value of the resource's parameter. For example, the following code returns 'param_value'.
 
-- *Type*: rvalue
+  *Example:*
+
+  ```
+  define example_resource($param) {
+  }
 
-chop
-----
-Returns a new string with the last character removed. If the string ends
-with `\r\n`, both characters are removed. Applying chop to an empty
-string returns an empty string. If you wish to merely remove record
-separators then you should use the `chomp` function.
-Requires a string or array of strings as input.
+  example_resource { "example_resource_instance":
+    param => "param_value"
+  }
+
+  getparam(Example_resource["example_resource_instance"], "param")
+  ```
+
+  *Type*: rvalue
 
+* `getvar`: Lookup a variable in a remote namespace.
 
-- *Type*: rvalue
+  For example:
+
+  ```
+  $foo = getvar('site::data::foo')
+  # Equivalent to $foo = $site::data::foo
+  ```
+
+  This is useful if the namespace itself is stored in a string:
 
-concat
-------
-Appends the contents of array 2 onto array 1.
+  ```
+  $datalocation = 'site::data'
+  $bar = getvar("${datalocation}::bar")
+  # Equivalent to $bar = $site::data::bar
+  ```
 
-*Example:*
+  *Type*: rvalue
 
-    concat(['1','2','3'],['4','5','6'])
+* `grep`: This function searches through an array and returns any elements that match the provided regular expression. For example, `grep(['aaa','bbb','ccc','aaaddd'], 'aaa')` returns ['aaa','aaaddd']. *Type*: rvalue
 
-Would result in:
+* `has_interface_with`: Returns boolean based on kind and value:
+  * macaddress
+  * netmask
+  * ipaddress
+  * network
 
-  ['1','2','3','4','5','6']
+  *Examples:*
 
-
-- *Type*: rvalue
+  ```
+  has_interface_with("macaddress", "x:x:x:x:x:x")
+  has_interface_with("ipaddress", "127.0.0.1")    => true
+  ```
+    
+  If no kind is given, then the presence of the interface is checked:
 
-count
------
-Takes an array as first argument and an optional second argument.
-Count the number of elements in array that matches second argument.
-If called with only an array it counts the number of elements that are not nil/undef.
+  ```
+  has_interface_with("lo")                        => true
+  ```
+
+  *Type*: rvalue
 
+* `has_ip_address`: Returns true if the client has the requested IP address on some interface. This function iterates through the `interfaces` fact and checks the `ipaddress_IFACE` facts, performing a simple string comparison. *Type*: rvalue
 
-- *Type*: rvalue
+* `has_ip_network`: Returns true if the client has an IP address within the requested network. This function iterates through the 'interfaces' fact and checks the 'network_IFACE' facts, performing a simple string comparision. *Type*: rvalue
+
+* `has_key`: Determine if a hash has a certain key value.
+
+  *Example*:
 
-defined_with_params
--------------------
-Takes a resource reference and an optional hash of attributes.
+  ```
+  $my_hash = {'key_one' => 'value_one'}
+  if has_key($my_hash, 'key_two') {
+    notice('we will not reach here')
+  }
+  if has_key($my_hash, 'key_one') {
+    notice('this will be printed')
+  }
+  ```
+  
+  *Type*: rvalue
 
-Returns true if a resource with the specified attributes has already been added
-to the catalog, and false otherwise.
+* `hash`: This function converts an array into a hash. For example, `hash(['a',1,'b',2,'c',3])` returns {'a'=>1,'b'=>2,'c'=>3}. *Type*: rvalue
+
+* `intersection`: This function returns an array an intersection of two. For example, `intersection(["a","b","c"],["b","c","d"])` returns ["b","c"].
 
-    user { 'dan':
-      ensure => present,
-    }
+* `is_array`: Returns 'true' if the variable passed to this function is an array. *Type*: rvalue
+
+* `is_bool`: Returns 'true' if the variable passed to this function is a boolean. *Type*: rvalue
+
+* `is_domain_name`: Returns 'true' if the string passed to this function is a syntactically correct domain name. *Type*: rvalue
 
-    if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
-      user { 'dan': ensure => present, }
-    }
+* `is_float`: Returns 'true' if the variable passed to this function is a float. *Type*: rvalue
+
+* `is_function_available`: This function accepts a string as an argument and determines whether the Puppet runtime has access to a function by that name. It returns 'true' if the function exists, 'false' if not. *Type*: rvalue
 
+* `is_hash`: Returns 'true' if the variable passed to this function is a hash. *Type*: rvalue
+
+* `is_integer`: Returns 'true' if the variable returned to this string is an integer. *Type*: rvalue
+
+* `is_ip_address`: Returns 'true' if the string passed to this function is a valid IP address. *Type*: rvalue
 
-- *Type*: rvalue
+* `is_mac_address`: Returns 'true' if the string passed to this function is a valid MAC address. *Type*: rvalue
+
+* `is_numeric`: Returns 'true' if the variable passed to this function is a number. *Type*: rvalue
+
+* `is_string`: Returns 'true' if the variable passed to this function is a string. *Type*: rvalue
 
-delete
-------
-Deletes all instances of a given element from an array, substring from a
-string, or key from a hash.
+* `join`: This function joins an array into a string using a separator. For example, `join(['a','b','c'], ",")` results in: "a,b,c". *Type*: rvalue
+
+* `join_keys_to_values`: This function joins each key of a hash to that key's corresponding value with a separator. Keys and values are cast to strings. The return value is an array in which each element is one joined key/value pair. For example, `join_keys_to_values({'a'=>1,'b'=>2}, " is ")` results in ["a is 1","b is 2"]. *Type*: rvalue
+
+* `keys`: Returns the keys of a hash as an array. *Type*: rvalue
 
-*Examples:*
+* `loadyaml`: Load a YAML file containing an array, string, or hash, and return the data in the corresponding native data type. For example:
 
-    delete(['a','b','c','b'], 'b')
-    Would return: ['a','c']
+  ```
+  $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
+  ```
+
+  *Type*: rvalue
 
-    delete({'a'=>1,'b'=>2,'c'=>3}, 'b')
-    Would return: {'a'=>1,'c'=>3}
+* `lstrip`: Strips leading spaces to the left of a string. *Type*: rvalue
+
+* `max`: Returns the highest value of all arguments. Requires at least one argument. *Type*: rvalue
 
-    delete('abracadabra', 'bra')
-    Would return: 'acada'
+* `member`: This function determines if a variable is a member of an array. The variable can be either a string, array, or fixnum. For example, `member(['a','b'], 'b')` and `member(['a','b','c'], ['b','c'])` return 'true', while `member(['a','b'], 'c')`  and `member(['a','b','c'], ['c','d'])` return 'false'. *Type*: rvalue
 
+* `merge`: Merges two or more hashes together and returns the resulting hash.
 
-- *Type*: rvalue
+  *Example*:
+  
+  ```
+  $hash1 = {'one' => 1, 'two' => 2}
+  $hash2 = {'two' => 'dos', 'three' => 'tres'}
+  $merged_hash = merge($hash1, $hash2)
+  # The resulting hash is equivalent to:
+  # $merged_hash =  {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
+  ```
+  
+  When there is a duplicate key, the key in the rightmost hash "wins." *Type*: rvalue
 
-delete_at
----------
-Deletes a determined indexed value from an array.
+* `min`: Returns the lowest value of all arguments. Requires at least one argument. *Type*: rvalue
 
-*Examples:*
+* `num2bool`: This function converts a number or a string representation of a number into a true boolean. Zero or anything non-numeric becomes 'false'. Numbers greater than 0 become 'true'. *Type*: rvalue
+
+* `parsejson`: This function accepts JSON as a string and converts into the correct Puppet structure. *Type*: rvalue
+
+* `parseyaml`: This function accepts YAML as a string and converts it into the correct Puppet structure. *Type*: rvalue
+
+* `pick`: From a list of values, returns the first value that is not undefined or an empty string. Takes any number of arguments, and raises an error if all values are undefined or empty.
 
-    delete_at(['a','b','c'], 1)
+  ```
+  $real_jenkins_version = pick($::jenkins_version, '1.449')
+  ```
+  
+ *Type*: rvalue
 
-Would return: ['a','c']
+* `prefix`: This function applies a prefix to all elements in an array. For example, `prefix(['a','b','c'], 'p')` returns ['pa','pb','pc']. *Type*: rvalue
 
 
-- *Type*: rvalue
-
-dirname
--------
-Returns the `dirname` of a path.
-
-*Examples:*
-
-    dirname('/path/to/a/file.ext')
+* `private`: This function sets the current class or definition as private.
+Calling the class or definition from outside the current module will fail. For example, `private()` called in class `foo::bar` outputs the following message if class is called from outside module `foo`:
 
-Would return: '/path/to/a'
-
-downcase
---------
-Converts the case of a string or all strings in an array to lower case.
+  ```
+  Class foo::bar is private
+  ```
+  
+  You can specify the error message you want to use:
+  
+  ```
+  private("You're not supposed to do that!")
+  ```
 
+  *Type*: statement
 
-- *Type*: rvalue
+* `range`: When given range in the form of '(start, stop)', `range` extrapolates a range as an array. For example, `range("0", "9")` returns [0,1,2,3,4,5,6,7,8,9]. Zero-padded strings are converted to integers automatically, so `range("00", "09")` returns [0,1,2,3,4,5,6,7,8,9].
 
-empty
------
-Returns true if the variable is empty.
+  Non-integer strings are accepted; `range("a", "c")` returns ["a","b","c"], and `range("host01", "host10")` returns ["host01", "host02", ..., "host09", "host10"]. 
+  
+  *Type*: rvalue
 
+* `reject`: This function searches through an array and rejects all elements that match the provided regular expression. For example, `reject(['aaa','bbb','ccc','aaaddd'], 'aaa')` returns ['bbb','ccc']. *Type*: rvalue
 
-- *Type*: rvalue
+* `reverse`: Reverses the order of a string or array. *Type*: rvalue
 
-ensure_packages
----------------
-Takes a list of packages and only installs them if they don't already exist.
+* `rstrip`: Strips leading spaces to the right of the string.*Type*: rvalue
 
+* `shuffle`: Randomizes the order of a string or array elements. *Type*: rvalue
 
-- *Type*: statement
+* `size`: Returns the number of elements in a string or array. *Type*: rvalue
 
-ensure_resource
----------------
-Takes a resource type, title, and a list of attributes that describe a
-resource.
+* `sort`: Sorts strings and arrays lexically. *Type*: rvalue
+
+* `squeeze`: Returns a new string where runs of the same character that occur in this set are replaced by a single character. *Type*: rvalue
 
-    user { 'dan':
-      ensure => present,
-    }
+* `str2bool`: This converts a string to a boolean. This attempts to convert strings that contain values such as '1', 't', 'y', and 'yes' to 'true' and strings that contain values such as '0', 'f', 'n', and 'no' to 'false'. *Type*: rvalue
 
-This example only creates the resource if it does not already exist:
+* `str2saltedsha512`: This converts a string to a salted-SHA512 password hash, used for OS X versions >= 10.7. Given any string, this function returns a hex version of a salted-SHA512 password hash, which can be inserted into your Puppet
+manifests as a valid password attribute. *Type*: rvalue
 
-    ensure_resource('user, 'dan', {'ensure' => 'present' })
+* `strftime`: This function returns formatted time. For example,  `strftime("%s")` returns the time since epoch, and `strftime("%Y=%m-%d")` returns the date. *Type*: rvalue
 
-If the resource already exists but does not match the specified parameters,
-this function will attempt to recreate the resource leading to a duplicate
-resource definition error.
-
-An array of resources can also be passed in and each will be created with
-the type and parameters specified if it doesn't already exist.
-
-    ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
-
-
-
-- *Type*: statement
-
-flatten
--------
-This function flattens any deeply nested arrays and returns a single flat array
-as a result.
-
-*Examples:*
-
-    flatten(['a', ['b', ['c']]])
-
-Would return: ['a','b','c']
-
-
-- *Type*: rvalue
-
-floor
------
-Returns the largest integer less or equal to the argument.
-Takes a single numeric value as an argument.
-
-
-- *Type*: rvalue
-
-fqdn_rotate
------------
-Rotates an array a random number of times based on a nodes fqdn.
-
-
-- *Type*: rvalue
-
-get_module_path
----------------
-Returns the absolute path of the specified module for the current
-environment.
-
-Example:
-  $module_path = get_module_path('stdlib')
+  *Format:*
+  
+    * `%a`: The abbreviated weekday name ('Sun')
+    * `%A`: The  full  weekday  name ('Sunday')
+    * `%b`: The abbreviated month name ('Jan')
+    * `%B`: The  full  month  name ('January')
+    * `%c`: The preferred local date and time representation
+    * `%C`: Century (20 in 2009)
+    * `%d`: Day of the month (01..31)
+    * `%D`: Date (%m/%d/%y)
+    * `%e`: Day of the month, blank-padded ( 1..31)
+    * `%F`: Equivalent to %Y-%m-%d (the ISO 8601 date format)
+    * `%h`: Equivalent to %b
+    * `%H`: Hour of the day, 24-hour clock (00..23)
+    * `%I`: Hour of the day, 12-hour clock (01..12)
+    * `%j`: Day of the year (001..366)
+    * `%k`: Hour, 24-hour clock, blank-padded ( 0..23)
+    * `%l`: Hour, 12-hour clock, blank-padded ( 0..12)
+    * `%L`: Millisecond of the second (000..999)
+    * `%m`: Month of the year (01..12)
+    * `%M`: Minute of the hour (00..59)
+    * `%n`: Newline (\n)
+    * `%N`: Fractional seconds digits, default is 9 digits (nanosecond)
+      * `%3N`: Millisecond (3 digits)
+      * `%6N`: Microsecond (6 digits)
+      * `%9N`: Nanosecond (9 digits)
+    * `%p`: Meridian indicator ('AM'  or  'PM')
+    * `%P`: Meridian indicator ('am'  or  'pm')
+    * `%r`: Time, 12-hour (same as %I:%M:%S %p)
+    * `%R`: Time, 24-hour (%H:%M)
+    * `%s`: Number of seconds since 1970-01-01 00:00:00 UTC.
+    * `%S`: Second of the minute (00..60)
+    * `%t`: Tab character (	)
+    * `%T`: Time, 24-hour (%H:%M:%S)
+    * `%u`: Day of the week as a decimal, Monday being 1. (1..7)
+    * `%U`: Week  number  of the current year, starting with the first Sunday as the first day of the first week (00..53)
+    * `%v`: VMS date (%e-%b-%Y)
+    * `%V`: Week number of year according to ISO 8601 (01..53)
+    * `%W`: Week  number of the current year, starting with the first Monday as the first day of the first week (00..53)
+    * `%w`: Day of the week (Sunday is 0, 0..6)
+    * `%x`: Preferred representation for the date alone, no time
+    * `%X`: Preferred representation for the time alone, no date
+    * `%y`: Year without a century (00..99)
+    * `%Y`: Year with century
+    * `%z`: Time zone as  hour offset from UTC (e.g. +0900)
+    * `%Z`: Time zone name
+    * `%%`: Literal '%' character
 
 
-- *Type*: rvalue
+* `strip`: This function removes leading and trailing whitespace from a string or from every string inside an array. For example, `strip("    aaa   ")` results in "aaa". *Type*: rvalue
+
+* `suffix`: This function applies a suffix to all elements in an array. For example, `suffix(['a','b','c'], 'p')` returns ['ap','bp','cp']. *Type*: rvalue
+
+* `swapcase`: This function swaps the existing case of a string. For example, `swapcase("aBcD")` results in "AbCd". *Type*: rvalue
+
+* `time`: This function returns the current time since epoch as an integer. For example, `time()` returns something like '1311972653'. *Type*: rvalue
+
+* `to_bytes`: Converts the argument into bytes, for example 4 kB becomes 4096.
+Takes a single string value as an argument. *Type*: rvalue
+
+* `type`: Returns the type when passed a variable. Type can be a string, array, hash, float, integer, or boolean. *Type*: rvalue
 
-getparam
---------
-Takes a resource reference and name of the parameter and
-returns value of resource's parameter.
+* `union`: This function returns a union of two arrays. For example, `union(["a","b","c"],["b","c","d"])` returns ["a","b","c","d"].
+
+* `unique`: This function removes duplicates from strings and arrays. For example, `unique("aabbcc")` returns 'abc'.
+
+You can also use this with arrays. For example, `unique(["a","a","b","b","c","c"])` returns ["a","b","c"]. *Type*: rvalue
 
-*Examples:*
+* `upcase`: Converts a string or an array of strings to uppercase. For example, `upcase("abcd")` returns 'ABCD'. *Type*: rvalue
 
-    define example_resource($param) {
-    }
+* `uriescape`: Urlencodes a string or array of strings. Requires either a single string or an array as an input. *Type*: rvalue
+
+* `validate_absolute_path`: Validate that the string represents an absolute path in the filesystem. This function works for Windows and Unix-style paths.
+  The following values will pass:
 
-    example_resource { "example_resource_instance":
-        param => "param_value"
-    }
+  ```
+  $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet"
+  validate_absolute_path($my_path)
+  $my_path2 = "/var/lib/puppet"
+  validate_absolute_path($my_path2)
+  ```
+
+  The following values will fail, causing compilation to abort:
 
-    getparam(Example_resource["example_resource_instance"], "param")
+  ```
+  validate_absolute_path(true)
+  validate_absolute_path([ 'var/lib/puppet', '/var/foo' ])
+  validate_absolute_path([ '/var/lib/puppet', 'var/foo' ])
+  $undefined = undef
+  validate_absolute_path($undefined)
+  ```
+  
+  *Type*: statement
 
-Would return: param_value
+* `validate_array`: Validate that all passed values are array data structures. Abort catalog compilation if any value fails this check. 
+
+  The following values will pass:
 
+  ```
+  $my_array = [ 'one', 'two' ]
+  validate_array($my_array)
+  ```
 
-- *Type*: rvalue
+  The following values will fail, causing compilation to abort:
 
-getvar
-------
-Lookup a variable in a remote namespace.
+  ```
+  validate_array(true)
+  validate_array('some_string')
+  $undefined = undef
+  validate_array($undefined)
+  ```
+
+  *Type*: statement
 
-For example:
+* `validate_augeas`: Performs validation of a string using an Augeas lens.
+The first argument of this function should be the string to test, and the second argument should be the name of the Augeas lens to use. If Augeas fails to parse the string with the lens, the compilation aborts with a parse error.
+
+  A third optional argument lists paths which should **not** be found in the file. The `$file` variable points to the location of the temporary file being tested in the Augeas tree.
 
-    $foo = getvar('site::data::foo')
-    # Equivalent to $foo = $site::data::foo
+  For example, to make sure your passwd content never contains user `foo`:
+
+  ```
+  validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo'])
+  ```
+  
+  To ensure that no users use the '/bin/barsh' shell:
 
-This is useful if the namespace itself is stored in a string:
+  ```
+  validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]']
+  ```
+  
+  You can pass a fourth argument as the error message raised and shown to the user:
 
-    $datalocation = 'site::data'
-    $bar = getvar("${datalocation}::bar")
-    # Equivalent to $bar = $site::data::bar
+  ```
+  validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas')
+  ```
 
+  *Type*: statement
+
+* `validate_bool`: Validate that all passed values are either true or false. Abort catalog compilation if any value fails this check.
 
-- *Type*: rvalue
+  The following values will pass:
+  
+  ```
+  $iamtrue = true
+  validate_bool(true)
+  validate_bool(true, true, false, $iamtrue)
+  ```
+  
+  The following values will fail, causing compilation to abort:
 
-grep
-----
-This function searches through an array and returns any elements that match
-the provided regular expression.
+  ```
+  $some_array = [ true ]
+  validate_bool("false")
+  validate_bool("true")
+  validate_bool($some_array)
+  ```
+
+  *Type*: statement
 
-*Examples:*
+* `validate_cmd`: Performs validation of a string with an external command. The first argument of this function should be the string to test, and the second argument should be the path to a test command taking a file as last argument. If the command, launched against a tempfile containing the passed string, returns a non-null value, compilation aborts with a parse error.
+
+  You can pass a third argument as the error message raised and shown to the user:
 
-    grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
+  ```
+  validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
+  ```
+  
+  *Type*: statement
 
-Would return:
+* `validate_hash`: Validates that all passed values are hash data structures. Abort catalog compilation if any value fails this check.
+
+  The following values will pass:
 
-    ['aaa','aaaddd']
+  ```
+  $my_hash = { 'one' => 'two' }
+  validate_hash($my_hash)
+  ```
+
+  The following values will fail, causing compilation to abort:
 
+  ```
+  validate_hash(true)
+  validate_hash('some_string')
+  $undefined = undef
+  validate_hash($undefined)
+  ```
+  
+  *Type*: statement
 
-- *Type*: rvalue
+* `validate_re`: Performs simple validation of a string against one or more regular expressions. The first argument of this function should be the string to
+test, and the second argument should be a stringified regular expression
+(without the // delimiters) or an array of regular expressions. If none
+of the regular expressions match the string passed in, compilation aborts with a parse error.
 
-has_interface_with
-------------------
-Returns boolean based on kind and value:
-* macaddress
-* netmask
-* ipaddress
-* network
+  You can pass a third argument as the error message raised and shown to the user.
+
+  The following strings validate against the regular expressions:
+
+  ```
+  validate_re('one', '^one$')
+  validate_re('one', [ '^one', '^two' ])
+  ```
+
+  The following string fails to validate, causing compilation to abort:
+
+  ```
+  validate_re('one', [ '^two', '^three' ])
+  ```
 
-has_interface_with("macaddress", "x:x:x:x:x:x")
-has_interface_with("ipaddress", "127.0.0.1")    => true
-etc.
+  To set the error message: 
+  
+  ```
+  validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7')
+  ```
 
-If no "kind" is given, then the presence of the interface is checked:
-has_interface_with("lo")                        => true
+  *Type*: statement
+
+* `validate_slength`: Validates that the first argument is a string (or an array of strings), and is less than or equal to the length of the second argument. It fails if the first argument is not a string or array of strings, or if arg 2 is not convertable to a number.
 
-
-- *Type*: rvalue
+  The following values pass:
+  
+  ```
+  validate_slength("discombobulate",17)
+  validate_slength(["discombobulate","moo"],17)
+  ```
+  
+  The following values fail:
 
-has_ip_address
---------------
-Returns true if the client has the requested IP address on some interface.
+  ```
+  validate_slength("discombobulate",1)
+  validate_slength(["discombobulate","thermometer"],5)
+  ```
+  
+  *Type*: statement
+
+* `validate_string`: Validates that all passed values are string data structures. Aborts catalog compilation if any value fails this check.
+
+  The following values pass:
+
+  ```
+  $my_string = "one two"
+  validate_string($my_string, 'three')
+  ```
+
+  The following values fail, causing compilation to abort:
 
-This function iterates through the 'interfaces' fact and checks the
-'ipaddress_IFACE' facts, performing a simple string comparison.
+  ```
+  validate_string(true)
+  validate_string([ 'some', 'array' ])
+  $undefined = undef
+  validate_string($undefined)
+  ```
 
+  *Type*: statement
 
-- *Type*: rvalue
+* `values`: When given a hash, this function returns the values of that hash.
+
+  *Examples:*
 
-has_ip_network
---------------
-Returns true if the client has an IP address within the requested network.
+  ```
+  $hash = {
+    'a' => 1,
+    'b' => 2,
+    'c' => 3,
+  }
+  values($hash)
+  ```
 
-This function iterates through the 'interfaces' fact and checks the
-'network_IFACE' facts, performing a simple string comparision.
+  The example above returns [1,2,3].
+
+  *Type*: rvalue
+
+* `values_at`: Finds value inside an array based on location. The first argument is the array you want to analyze, and the second element can be a combination of:
 
+  * A single numeric index
+  * A range in the form of 'start-stop' (eg. 4-9)
+  * An array combining the above
+
+  For example, `values_at(['a','b','c'], 2)` returns ['c']; `values_at(['a','b','c'], ["0-1"])` returns ['a','b']; and `values_at(['a','b','c','d','e'], [0, "2-3"])` returns ['a','c','d'].
 
-- *Type*: rvalue
+  *Type*: rvalue
+
+* `zip`: Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments. For example, `zip(['1','2','3'],['4','5','6'])` results in ["1", "4"], ["2", "5"], ["3", "6"]. *Type*: rvalue
+
+##Limitations
+
+As of Puppet Enterprise version 3.7, the stdlib module is no longer included in PE. PE users should install the most recent release of stdlib for compatibility with Puppet modules.
 
-has_key
--------
-Determine if a hash has a certain key value.
+###Version Compatibility
 
-Example:
+Versions | Puppet 2.6 | Puppet 2.7 | Puppet 3.x | Puppet 4.x | 
+:---------------|:-----:|:---:|:---:|:----:
+**stdlib 2.x**  | **yes** | **yes** | no | no
+**stdlib 3.x**  | no    | **yes**  | **yes** | no
+**stdlib 4.x**  | no    | **yes**  | **yes** | no
+**stdlib 5.x**  | no    | no  | **yes**  | **yes**
 
-    $my_hash = {'key_one' => 'value_one'}
-    if has_key($my_hash, 'key_two') {
-      notice('we will not reach here')
-    }
-    if has_key($my_hash, 'key_one') {
-      notice('this will be printed')
-    }
+**stdlib 5.x**: When released, stdlib 5.x will drop support for Puppet 2.7.x. Please see [this discussion](https://github.com/puppetlabs/puppetlabs-stdlib/pull/176#issuecomment-30251414).
+
+##Development
+
+Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
+
+We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
+
+You can read the complete module contribution guide on the [Puppet Labs wiki](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing).
+
+To report or research a bug with any part of this module, please go to
+[http://tickets.puppetlabs.com/browse/PUP](http://tickets.puppetlabs.com/browse/PUP).
+
+##Contributors
+
+The list of contributors can be found at: https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors
 
 
 
-- *Type*: rvalue
 
-hash
-----
-This function converts an array into a hash.
-
-*Examples:*
-
-    hash(['a',1,'b',2,'c',3])
-
-Would return: {'a'=>1,'b'=>2,'c'=>3}
-
-
-- *Type*: rvalue
-
-is_array
---------
-Returns true if the variable passed to this function is an array.
-
-- *Type*: rvalue
-
-is_domain_name
---------------
-Returns true if the string passed to this function is a syntactically correct domain name.
-
-- *Type*: rvalue
-
-is_float
---------
-Returns true if the variable passed to this function is a float.
-
-- *Type*: rvalue
-
-is_function_available
----------------------
-This function accepts a string as an argument, determines whether the
-Puppet runtime has access to a function by that name.  It returns a
-true if the function exists, false if not.
-
-- *Type*: rvalue
-
-is_hash
--------
-Returns true if the variable passed to this function is a hash.
-
-- *Type*: rvalue
-
-is_integer
-----------
-Returns true if the variable returned to this string is an integer.
-
-- *Type*: rvalue
-
-is_ip_address
--------------
-Returns true if the string passed to this function is a valid IP address.
-
-- *Type*: rvalue
-
-is_mac_address
---------------
-Returns true if the string passed to this function is a valid mac address.
-
-- *Type*: rvalue
-
-is_numeric
-----------
-Returns true if the variable passed to this function is a number.
-
-- *Type*: rvalue
-
-is_string
----------
-Returns true if the variable passed to this function is a string.
-
-- *Type*: rvalue
-
-join
-----
-This function joins an array into a string using a seperator.
-
-*Examples:*
-
-    join(['a','b','c'], ",")
-
-Would result in: "a,b,c"
-
-- *Type*: rvalue
-
-join_keys_to_values
--------------------
-This function joins each key of a hash to that key's corresponding value with a
-separator. Keys and values are cast to strings. The return value is an array in
-which each element is one joined key/value pair.
-
-*Examples:*
-
-    join_keys_to_values({'a'=>1,'b'=>2}, " is ")
-
-Would result in: ["a is 1","b is 2"]
-
-- *Type*: rvalue
-
-keys
-----
-Returns the keys of a hash as an array.
-
-- *Type*: rvalue
-
-loadyaml
---------
-Load a YAML file containing an array, string, or hash, and return the data
-in the corresponding native data type.
-
-For example:
-
-    $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
-
-
-- *Type*: rvalue
-
-lstrip
-------
-Strips leading spaces to the left of a string.
-
-- *Type*: rvalue
-
-max
----
-Returns the highest value of all arguments.
-Requires at least one argument.
-
-- *Type*: rvalue
-
-member
-------
-This function determines if a variable is a member of an array.
-
-*Examples:*
-
-    member(['a','b'], 'b')
-
-Would return: true
-
-    member(['a','b'], 'c')
-
-Would return: false
-
-- *Type*: rvalue
-
-merge
------
-Merges two or more hashes together and returns the resulting hash.
-
-For example:
-
-    $hash1 = {'one' => 1, 'two', => 2}
-    $hash2 = {'two' => 'dos', 'three', => 'tres'}
-    $merged_hash = merge($hash1, $hash2)
-    # The resulting hash is equivalent to:
-    # $merged_hash =  {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
-
-When there is a duplicate key, the key in the rightmost hash will "win."
-
-- *Type*: rvalue
-
-min
----
-Returns the lowest value of all arguments.
-Requires at least one argument.
-
-- *Type*: rvalue
-
-num2bool
---------
-This function converts a number or a string representation of a number into a
-true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0
-become true.
-
-- *Type*: rvalue
-
-parsejson
----------
-This function accepts JSON as a string and converts into the correct Puppet
-structure.
-
-- *Type*: rvalue
-
-parseyaml
----------
-This function accepts YAML as a string and converts it into the correct
-Puppet structure.
-
-- *Type*: rvalue
-
-pick
-----
-This function is similar to a coalesce function in SQL in that it will return
-the first value in a list of values that is not undefined or an empty string
-(two things in Puppet that will return a boolean false value). Typically,
-this function is used to check for a value in the Puppet Dashboard/Enterprise
-Console, and failover to a default value like the following:
-
-    $real_jenkins_version = pick($::jenkins_version, '1.449')
-
-The value of $real_jenkins_version will first look for a top-scope variable
-called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
-Enterprise Console are brought into Puppet as top-scope variables), and,
-failing that, will use a default value of 1.449.
-
-- *Type*: rvalue
-
-prefix
-------
-This function applies a prefix to all elements in an array.
-
-*Examples:*
-
-    prefix(['a','b','c'], 'p')
-
-Will return: ['pa','pb','pc']
-
-- *Type*: rvalue
-
-range
------
-When given range in the form of (start, stop) it will extrapolate a range as
-an array.
-
-*Examples:*
-
-    range("0", "9")
-
-Will return: [0,1,2,3,4,5,6,7,8,9]
-
-    range("00", "09")
-
-Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to
-integers automatically)
-
-    range("a", "c")
-
-Will return: ["a","b","c"]
-
-    range("host01", "host10")
-
-Will return: ["host01", "host02", ..., "host09", "host10"]
-
-- *Type*: rvalue
-
-reject
-------
-This function searches through an array and rejects all elements that match
-the provided regular expression.
-
-*Examples:*
-
-    reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
-
-Would return:
-
-    ['bbb','ccc']
-
-
-- *Type*: rvalue
-
-reverse
--------
-Reverses the order of a string or array.
-
-- *Type*: rvalue
-
-rstrip
-------
-Strips leading spaces to the right of the string.
-
-- *Type*: rvalue
-
-shuffle
--------
-Randomizes the order of a string or array elements.
-
-- *Type*: rvalue
-
-size
-----
-Returns the number of elements in a string or array.
-
-- *Type*: rvalue
-
-sort
-----
-Sorts strings and arrays lexically.
-
-- *Type*: rvalue
-
-squeeze
--------
-Returns a new string where runs of the same character that occur in this set
-are replaced by a single character.
-
-- *Type*: rvalue
-
-str2bool
---------
-This converts a string to a boolean. This attempt to convert strings that
-contain things like: y, 1, t, true to 'true' and strings that contain things
-like: 0, f, n, false, no to 'false'.
-
-
-- *Type*: rvalue
-
-str2saltedsha512
-----------------
-This converts a string to a salted-SHA512 password hash (which is used for
-OS X versions >= 10.7). Given any simple string, you will get a hex version
-of a salted-SHA512 password hash that can be inserted into your Puppet
-manifests as a valid password attribute.
-
-
-- *Type*: rvalue
-
-strftime
---------
-This function returns formatted time.
-
-*Examples:*
-
-To return the time since epoch:
-
-    strftime("%s")
-
-To return the date:
-
-    strftime("%Y-%m-%d")
-
-*Format meaning:*
-
-    %a - The abbreviated weekday name (``Sun'')
-    %A - The  full  weekday  name (``Sunday'')
-    %b - The abbreviated month name (``Jan'')
-    %B - The  full  month  name (``January'')
-    %c - The preferred local date and time representation
-    %C - Century (20 in 2009)
-    %d - Day of the month (01..31)
-    %D - Date (%m/%d/%y)
-    %e - Day of the month, blank-padded ( 1..31)
-    %F - Equivalent to %Y-%m-%d (the ISO 8601 date format)
-    %h - Equivalent to %b
-    %H - Hour of the day, 24-hour clock (00..23)
-    %I - Hour of the day, 12-hour clock (01..12)
-    %j - Day of the year (001..366)
-    %k - hour, 24-hour clock, blank-padded ( 0..23)
-    %l - hour, 12-hour clock, blank-padded ( 0..12)
-    %L - Millisecond of the second (000..999)
-    %m - Month of the year (01..12)
-    %M - Minute of the hour (00..59)
-    %n - Newline (
-)
-    %N - Fractional seconds digits, default is 9 digits (nanosecond)
-            %3N  millisecond (3 digits)
-            %6N  microsecond (6 digits)
-            %9N  nanosecond (9 digits)
-    %p - Meridian indicator (``AM''  or  ``PM'')
-    %P - Meridian indicator (``am''  or  ``pm'')
-    %r - time, 12-hour (same as %I:%M:%S %p)
-    %R - time, 24-hour (%H:%M)
-    %s - Number of seconds since 1970-01-01 00:00:00 UTC.
-    %S - Second of the minute (00..60)
-    %t - Tab character (	)
-    %T - time, 24-hour (%H:%M:%S)
-    %u - Day of the week as a decimal, Monday being 1. (1..7)
-    %U - Week  number  of the current year,
-            starting with the first Sunday as the first
-            day of the first week (00..53)
-    %v - VMS date (%e-%b-%Y)
-    %V - Week number of year according to ISO 8601 (01..53)
-    %W - Week  number  of the current year,
-            starting with the first Monday as the first
-            day of the first week (00..53)
-    %w - Day of the week (Sunday is 0, 0..6)
-    %x - Preferred representation for the date alone, no time
-    %X - Preferred representation for the time alone, no date
-    %y - Year without a century (00..99)
-    %Y - Year with century
-    %z - Time zone as  hour offset from UTC (e.g. +0900)
-    %Z - Time zone name
-    %% - Literal ``%'' character
-
-
-- *Type*: rvalue
-
-strip
------
-This function removes leading and trailing whitespace from a string or from
-every string inside an array.
-
-*Examples:*
-
-    strip("    aaa   ")
-
-Would result in: "aaa"
-
-
-- *Type*: rvalue
-
-suffix
-------
-This function applies a suffix to all elements in an array.
-
-*Examples:*
-
-    suffix(['a','b','c'], 'p')
-
-Will return: ['ap','bp','cp']
-
-
-- *Type*: rvalue
-
-swapcase
---------
-This function will swap the existing case of a string.
-
-*Examples:*
-
-    swapcase("aBcD")
-
-Would result in: "AbCd"
-
-
-- *Type*: rvalue
-
-time
-----
-This function will return the current time since epoch as an integer.
-
-*Examples:*
-
-    time()
-
-Will return something like: 1311972653
-
-
-- *Type*: rvalue
-
-to_bytes
---------
-Converts the argument into bytes, for example 4 kB becomes 4096.
-Takes a single string value as an argument.
-
-
-- *Type*: rvalue
-
-type
-----
-Returns the type when passed a variable. Type can be one of:
-
-* string
-* array
-* hash
-* float
-* integer
-* boolean
-
-
-- *Type*: rvalue
-
-unique
-------
-This function will remove duplicates from strings and arrays.
-
-*Examples:*
-
-    unique("aabbcc")
-
-Will return:
-
-    abc
-
-You can also use this with arrays:
-
-    unique(["a","a","b","b","c","c"])
-
-This returns:
-
-    ["a","b","c"]
-
-
-- *Type*: rvalue
-
-upcase
-------
-Converts a string or an array of strings to uppercase.
-
-*Examples:*
-
-    upcase("abcd")
-
-Will return:
-
-    ASDF
-
-
-- *Type*: rvalue
-
-uriescape
----------
-Urlencodes a string or array of strings.
-Requires either a single string or an array as an input.
-
-
-- *Type*: rvalue
-
-validate_absolute_path
-----------------------
-Validate the string represents an absolute path in the filesystem.  This function works
-for windows and unix style paths.
-
-The following values will pass:
-
-    $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet"
-    validate_absolute_path($my_path)
-    $my_path2 = "/var/lib/puppet"
-    validate_absolute_path($my_path2)
-
-
-The following values will fail, causing compilation to abort:
-
-    validate_absolute_path(true)
-    validate_absolute_path([ 'var/lib/puppet', '/var/foo' ])
-    validate_absolute_path([ '/var/lib/puppet', 'var/foo' ])
-    $undefined = undef
-    validate_absolute_path($undefined)
-
-
-
-- *Type*: statement
-
-validate_array
---------------
-Validate that all passed values are array data structures. Abort catalog
-compilation if any value fails this check.
-
-The following values will pass:
-
-    $my_array = [ 'one', 'two' ]
-    validate_array($my_array)
-
-The following values will fail, causing compilation to abort:
-
-    validate_array(true)
-    validate_array('some_string')
-    $undefined = undef
-    validate_array($undefined)
-
-
-
-- *Type*: statement
-
-validate_augeas
----------------
-Perform validation of a string using an Augeas lens
-The first argument of this function should be a string to
-test, and the second argument should be the name of the Augeas lens to use.
-If Augeas fails to parse the string with the lens, the compilation will
-abort with a parse error.
-
-A third argument can be specified, listing paths which should
-not be found in the file. The `$file` variable points to the location
-of the temporary file being tested in the Augeas tree.
-
-For example, if you want to make sure your passwd content never contains
-a user `foo`, you could write:
-
-    validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo'])
-
-Or if you wanted to ensure that no users used the '/bin/barsh' shell,
-you could use:
-
-    validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]']
-
-If a fourth argument is specified, this will be the error message raised and
-seen by the user.
-
-A helpful error message can be returned like this:
-
-    validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas')
-
-
-
-- *Type*: statement
-
-validate_bool
--------------
-Validate that all passed values are either true or false. Abort catalog
-compilation if any value fails this check.
-
-The following values will pass:
-
-    $iamtrue = true
-    validate_bool(true)
-    validate_bool(true, true, false, $iamtrue)
-
-The following values will fail, causing compilation to abort:
-
-    $some_array = [ true ]
-    validate_bool("false")
-    validate_bool("true")
-    validate_bool($some_array)
-
-
-
-- *Type*: statement
-
-validate_cmd
-------------
-Perform validation of a string with an external command.
-The first argument of this function should be a string to
-test, and the second argument should be a path to a test command
-taking a file as last argument. If the command, launched against
-a tempfile containing the passed string, returns a non-null value,
-compilation will abort with a parse error.
-
-If a third argument is specified, this will be the error message raised and
-seen by the user.
-
-A helpful error message can be returned like this:
-
-Example:
-
-    validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
-
-
-
-- *Type*: statement
-
-validate_hash
--------------
-Validate that all passed values are hash data structures. Abort catalog
-compilation if any value fails this check.
-
-The following values will pass:
-
-    $my_hash = { 'one' => 'two' }
-    validate_hash($my_hash)
-
-The following values will fail, causing compilation to abort:
-
-    validate_hash(true)
-    validate_hash('some_string')
-    $undefined = undef
-    validate_hash($undefined)
-
-
-
-- *Type*: statement
-
-validate_re
------------
-Perform simple validation of a string against one or more regular
-expressions. The first argument of this function should be a string to
-test, and the second argument should be a stringified regular expression
-(without the // delimiters) or an array of regular expressions.  If none
-of the regular expressions match the string passed in, compilation will
-abort with a parse error.
-
-If a third argument is specified, this will be the error message raised and
-seen by the user.
-
-The following strings will validate against the regular expressions:
-
-    validate_re('one', '^one$')
-    validate_re('one', [ '^one', '^two' ])
-
-The following strings will fail to validate, causing compilation to abort:
-
-    validate_re('one', [ '^two', '^three' ])
-
-A helpful error message can be returned like this:
-
-    validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7')
-
-
-
-- *Type*: statement
-
-validate_slength
-----------------
-Validate that the first argument is a string (or an array of strings), and
-less/equal to than the length of the second argument.  It fails if the first
-argument is not a string or array of strings, and if arg 2 is not convertable
-to a number.
-
-The following values will pass:
-
-  validate_slength("discombobulate",17)
-  validate_slength(["discombobulate","moo"],17)
-
-The following valueis will not:
-
-  validate_slength("discombobulate",1)
-  validate_slength(["discombobulate","thermometer"],5)
-
-
-
-- *Type*: statement
-
-validate_string
----------------
-Validate that all passed values are string data structures. Abort catalog
-compilation if any value fails this check.
-
-The following values will pass:
-
-    $my_string = "one two"
-    validate_string($my_string, 'three')
-
-The following values will fail, causing compilation to abort:
-
-    validate_string(true)
-    validate_string([ 'some', 'array' ])
-    $undefined = undef
-    validate_string($undefined)
-
-
-- *Type*: statement
-
-values
-------
-When given a hash this function will return the values of that hash.
-
-*Examples:*
-
-    $hash = {
-      'a' => 1,
-      'b' => 2,
-      'c' => 3,
-    }
-    values($hash)
-
-This example would return:
-
-    [1,2,3]
-
-
-- *Type*: rvalue
-
-values_at
----------
-Finds value inside an array based on location.
-
-The first argument is the array you want to analyze, and the second element can
-be a combination of:
-
-* A single numeric index
-* A range in the form of 'start-stop' (eg. 4-9)
-* An array combining the above
-
-*Examples*:
-
-    values_at(['a','b','c'], 2)
-
-Would return ['c'].
-
-    values_at(['a','b','c'], ["0-1"])
-
-Would return ['a','b'].
-
-    values_at(['a','b','c','d','e'], [0, "2-3"])
-
-Would return ['a','c','d'].
-
-
-- *Type*: rvalue
-
-zip
----
-Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments.
-
-*Example:*
-
-    zip(['1','2','3'],['4','5','6'])
-
-Would result in:
-
-    ["1", "4"], ["2", "5"], ["3", "6"]
-
-
-- *Type*: rvalue
-
-*This page autogenerated on 2013-04-11 13:54:25 -0700*
--- a/modules/stdlib/Rakefile	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/Rakefile	Sat Mar 14 20:09:45 2015 +0000
@@ -1,2 +1,18 @@
 require 'rubygems'
 require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+PuppetLint.configuration.send('disable_80chars')
+PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
+
+desc "Validate manifests, templates, and ruby files in lib."
+task :validate do
+  Dir['manifests/**/*.pp'].each do |manifest|
+    sh "puppet parser validate --noop #{manifest}"
+  end
+  Dir['lib/**/*.rb'].each do |lib_file|
+    sh "ruby -c #{lib_file}"
+  end
+  Dir['templates/**/*.erb'].each do |template|
+    sh "erb -P -x -T '-' #{template} | ruby -c"
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/checksums.json	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,360 @@
+{
+  "CHANGELOG.md": "362393816214b80a8a741e0e1662b928",
+  "CONTRIBUTING.md": "e2b8e8e433fc76b3798b7fe435f49375",
+  "Gemfile": "79b9a1e16b5bd1d4224109e197591894",
+  "LICENSE": "38a048b9d82e713d4e1b2573e370a756",
+  "README.markdown": "ce381313a5288355111472e1a0ade266",
+  "README_DEVELOPER.markdown": "220a8b28521b5c5d2ea87c4ddb511165",
+  "README_SPECS.markdown": "82bb4c6abbb711f40778b162ec0070c1",
+  "RELEASE_PROCESS.markdown": "94b92bc99ac4106ba1a74d5c04e520f9",
+  "Rakefile": "dfa334598bfd087adf11533a72d71106",
+  "lib/facter/facter_dot_d.rb": "15c1ec06d198c8e7cf2339ca34211b7a",
+  "lib/facter/pe_version.rb": "4a9353952963b011759f3e6652a10da5",
+  "lib/facter/puppet_vardir.rb": "c7ddc97e8a84ded3dd93baa5b9b3283d",
+  "lib/facter/root_home.rb": "d9c8276acdceb7340d95f60c36dcdcc5",
+  "lib/facter/util/puppet_settings.rb": "9f1d2593d0ae56bfca89d4b9266aeee1",
+  "lib/puppet/parser/functions/abs.rb": "32161bd0435fdfc2aec2fc559d2b454b",
+  "lib/puppet/parser/functions/any2array.rb": "a81e71d6b67a551d38770ba9a1948a75",
+  "lib/puppet/parser/functions/base64.rb": "ae25adf92295df67ebd9edfabc9ecdd6",
+  "lib/puppet/parser/functions/bool2num.rb": "f953f5fc094c2ae3908a72d8840ba291",
+  "lib/puppet/parser/functions/bool2str.rb": "34497af8db94754542b9d4cfacc8a27f",
+  "lib/puppet/parser/functions/camelcase.rb": "71c67b71eac4b7f46a0dd22cb915d2e6",
+  "lib/puppet/parser/functions/capitalize.rb": "da131748a9d32da9eb0b6438e39377eb",
+  "lib/puppet/parser/functions/chomp.rb": "2b7dc42f9967edd34cfa0ba9a97229ca",
+  "lib/puppet/parser/functions/chop.rb": "0ec76f54afd94201f35785dfeb2092b5",
+  "lib/puppet/parser/functions/concat.rb": "5c0cfccb20d5553e5a7d14ba1aa70fc5",
+  "lib/puppet/parser/functions/count.rb": "9eb74eccd93e2b3c87fd5ea14e329eba",
+  "lib/puppet/parser/functions/deep_merge.rb": "d83696855578fb81b64b9e92b9c7cc7c",
+  "lib/puppet/parser/functions/defined_with_params.rb": "ffab4433d03f32b551f2ea024a2948fc",
+  "lib/puppet/parser/functions/delete.rb": "96e569dac96b8c9387e9303445d73048",
+  "lib/puppet/parser/functions/delete_at.rb": "6bc24b79390d463d8be95396c963381a",
+  "lib/puppet/parser/functions/delete_undef_values.rb": "b32d4a3925753b2eb2c318cbd7f14404",
+  "lib/puppet/parser/functions/delete_values.rb": "39b147f7d369bb5f809044b6341954a2",
+  "lib/puppet/parser/functions/difference.rb": "e31b95fbaf974cf853a510177368bfb9",
+  "lib/puppet/parser/functions/dirname.rb": "bef7214eb89db3eb8f7ee5fc9dca0233",
+  "lib/puppet/parser/functions/downcase.rb": "73121616d73339cf8dd10e0de61a6c50",
+  "lib/puppet/parser/functions/empty.rb": "0b6ca9d0550a39c1ca50fc3d1ecbc98c",
+  "lib/puppet/parser/functions/ensure_packages.rb": "fbed5c0c9bf82b7746e01f15f89d184f",
+  "lib/puppet/parser/functions/ensure_resource.rb": "6678127386e77bbc0f09db7b5a32ab6a",
+  "lib/puppet/parser/functions/flatten.rb": "25777b76f9719162a8bab640e5595b7a",
+  "lib/puppet/parser/functions/floor.rb": "42cad4c689231a51526c55a6f0985d1f",
+  "lib/puppet/parser/functions/fqdn_rotate.rb": "37be809c17902c1ecf9bb2b20f0bfacd",
+  "lib/puppet/parser/functions/get_module_path.rb": "d4bf50da25c0b98d26b75354fa1bcc45",
+  "lib/puppet/parser/functions/getparam.rb": "4dd7a0e35f4a3780dcfc9b19b4e0006e",
+  "lib/puppet/parser/functions/getvar.rb": "ab01ce68140bbdd84162a519a14ece3b",
+  "lib/puppet/parser/functions/grep.rb": "5682995af458b05f3b53dd794c4bf896",
+  "lib/puppet/parser/functions/has_interface_with.rb": "ee3a1d6193951939b492a69ef170faac",
+  "lib/puppet/parser/functions/has_ip_address.rb": "ee207f47906455a5aa49c4fb219dd325",
+  "lib/puppet/parser/functions/has_ip_network.rb": "b4d726c8b2a0afac81ced8a3a28aa731",
+  "lib/puppet/parser/functions/has_key.rb": "7cd9728c38f0b0065f832dabd62b0e7e",
+  "lib/puppet/parser/functions/hash.rb": "9d072527dfc7354b69292e9302906530",
+  "lib/puppet/parser/functions/intersection.rb": "924ac4aceec7b896952166a7ec08fdb1",
+  "lib/puppet/parser/functions/is_array.rb": "875ca4356cb0d7a10606fb146b4a3d11",
+  "lib/puppet/parser/functions/is_bool.rb": "e693b7c4b5366cff1380b6e0c7dd7b11",
+  "lib/puppet/parser/functions/is_domain_name.rb": "cf72726c0fec831eb703ec9deea739eb",
+  "lib/puppet/parser/functions/is_float.rb": "10e0d3ecf75fac15e415aee79acf70dc",
+  "lib/puppet/parser/functions/is_function_available.rb": "628428bbcd9313ce09783d9484330e09",
+  "lib/puppet/parser/functions/is_hash.rb": "8c7d9a05084dab0389d1b779c8a05b1a",
+  "lib/puppet/parser/functions/is_integer.rb": "c665be82686aa4729959bb42c66a7510",
+  "lib/puppet/parser/functions/is_ip_address.rb": "a714a736c1560e8739aaacd9030cca00",
+  "lib/puppet/parser/functions/is_mac_address.rb": "288bd4b38d4df42a83681f13e7eaaee0",
+  "lib/puppet/parser/functions/is_numeric.rb": "93ddc9d4c0834a5e5e0562d7b3cdce91",
+  "lib/puppet/parser/functions/is_string.rb": "2bd9a652bbb2668323eee6c57729ff64",
+  "lib/puppet/parser/functions/join.rb": "a285a05c015ae278608f6454aef211ea",
+  "lib/puppet/parser/functions/join_keys_to_values.rb": "f29da49531228f6ca5b3aa0df00a14c2",
+  "lib/puppet/parser/functions/keys.rb": "eb6ac815ea14fbf423580ed903ef7bad",
+  "lib/puppet/parser/functions/loadyaml.rb": "2b912f257aa078e376d3b3f6a86c2a00",
+  "lib/puppet/parser/functions/lstrip.rb": "20a9b1fa077c16f34e0ef5448b895698",
+  "lib/puppet/parser/functions/max.rb": "f652fd0b46ef7d2fbdb42b141f8fdd1d",
+  "lib/puppet/parser/functions/member.rb": "3c5375ebf3e2dafa84903009f0f1f47c",
+  "lib/puppet/parser/functions/merge.rb": "f3dcc5c83440cdda2036cce69b61a14b",
+  "lib/puppet/parser/functions/min.rb": "0d2a1b7e735ab251c5469e735fa3f4c6",
+  "lib/puppet/parser/functions/num2bool.rb": "605c12fa518c87ed2c66ae153e0686ce",
+  "lib/puppet/parser/functions/parsejson.rb": "e7f968c34928107b84cd0860daf50ab1",
+  "lib/puppet/parser/functions/parseyaml.rb": "00f10ec1e2b050e23d80c256061ebdd7",
+  "lib/puppet/parser/functions/pick.rb": "bf01f13bbfe2318e7f6a302ac7c4433f",
+  "lib/puppet/parser/functions/pick_default.rb": "ad3ea60262de408767786d37a54d45dc",
+  "lib/puppet/parser/functions/prefix.rb": "aebbea0290be82a4ae89ddfffbee1125",
+  "lib/puppet/parser/functions/private.rb": "065102bb39f665d65420c97dda740a40",
+  "lib/puppet/parser/functions/range.rb": "b8bbbc3179ea8e1c84952137cfc97cd0",
+  "lib/puppet/parser/functions/reject.rb": "689f6a7c961a55fe9dcd240921f4c7f9",
+  "lib/puppet/parser/functions/reverse.rb": "b234b54b8cd62b2d67ccd70489ffdccf",
+  "lib/puppet/parser/functions/rstrip.rb": "b4e4ada41f7c1d2fcad073ce6344980f",
+  "lib/puppet/parser/functions/shuffle.rb": "d50f72b0aeb921e64d2482f62488e2f3",
+  "lib/puppet/parser/functions/size.rb": "8972d48c0f9e487d659bd7326b40b642",
+  "lib/puppet/parser/functions/sort.rb": "504b033b438461ca4f9764feeb017833",
+  "lib/puppet/parser/functions/squeeze.rb": "541f85b4203b55c9931d3d6ecd5c75f8",
+  "lib/puppet/parser/functions/str2bool.rb": "6320f1a50fd28ec027981cd1fb8ffdd0",
+  "lib/puppet/parser/functions/str2saltedsha512.rb": "49afad7b386be38ce53deaefef326e85",
+  "lib/puppet/parser/functions/strftime.rb": "e02e01a598ca5d7d6eee0ba22440304a",
+  "lib/puppet/parser/functions/strip.rb": "85d70ab95492e3e4ca5f0b5ec3f284a9",
+  "lib/puppet/parser/functions/suffix.rb": "109279db4180441e75545dbd5f273298",
+  "lib/puppet/parser/functions/swapcase.rb": "b17a9f3cb0271451d309e4b4f52dd651",
+  "lib/puppet/parser/functions/time.rb": "08d88d52abd1e230e3a2f82107545d48",
+  "lib/puppet/parser/functions/to_bytes.rb": "65437027687b6172173b3a211a799e37",
+  "lib/puppet/parser/functions/type.rb": "62f914d6c90662aaae40c5539701be60",
+  "lib/puppet/parser/functions/union.rb": "137998fe47decf25aede20f0c0155a4c",
+  "lib/puppet/parser/functions/unique.rb": "c1bb4a8aeebd09ba3e4c8bc3702cfd60",
+  "lib/puppet/parser/functions/upcase.rb": "086a7a470f738c4cb4cfc44591f1c00a",
+  "lib/puppet/parser/functions/uriescape.rb": "4638c351a373450495d6ce38e708ec67",
+  "lib/puppet/parser/functions/validate_absolute_path.rb": "385137ac24a2dec6cecc4e6ea75be442",
+  "lib/puppet/parser/functions/validate_array.rb": "72b29289b8af1cfc3662ef9be78911b8",
+  "lib/puppet/parser/functions/validate_augeas.rb": "b57e68fca390759782885474dc3ab2d0",
+  "lib/puppet/parser/functions/validate_bool.rb": "a712634a000024398b3c6cd4ecc46463",
+  "lib/puppet/parser/functions/validate_cmd.rb": "232dff623067f137bff364c67186dc05",
+  "lib/puppet/parser/functions/validate_hash.rb": "e9cfaca68751524efe16ecf2f958a9a0",
+  "lib/puppet/parser/functions/validate_ipv4_address.rb": "a8fb6f0ca36aa460d462c07c2af5d5a2",
+  "lib/puppet/parser/functions/validate_ipv6_address.rb": "4699238e4cad60e7e1428905523eaeb7",
+  "lib/puppet/parser/functions/validate_re.rb": "c6664b3943bc820415a43f16372dc2a9",
+  "lib/puppet/parser/functions/validate_slength.rb": "7e67c213509b9383707819cc612b2a29",
+  "lib/puppet/parser/functions/validate_string.rb": "cf6a20877a27b1073d63fdd522af50bb",
+  "lib/puppet/parser/functions/values.rb": "066a6e4170e5034edb9a80463dff2bb5",
+  "lib/puppet/parser/functions/values_at.rb": "325a899e0201e8df5bd483fec6f12d76",
+  "lib/puppet/parser/functions/zip.rb": "a89d5e802bc1e63e52020c2ddbaaca2c",
+  "lib/puppet/provider/file_line/ruby.rb": "bed19aaf4d9d06b646c554e1cdf37d2d",
+  "lib/puppet/type/anchor.rb": "bbd36bb49c3b554f8602d8d3df366c0c",
+  "lib/puppet/type/file_line.rb": "cd82d70a6af6c1b695126ee3e4ea7d00",
+  "manifests/init.pp": "f2ba5f36e7227ed87bbb69034fc0de8b",
+  "manifests/stages.pp": "cc6ed1751d334b0ea278c0335c7f0b5a",
+  "metadata.json": "8ddf2dab3ba00fea41147c257fddc1ba",
+  "spec/acceptance/abs_spec.rb": "538db8d037db814b455a6d741e91bb8d",
+  "spec/acceptance/any2array_spec.rb": "de86ead0205acbb3eca3a8a4792bdac8",
+  "spec/acceptance/base64_spec.rb": "1684d5dd176dd5bbd4c3c6b1e64fbcea",
+  "spec/acceptance/bool2num_spec.rb": "bf53ceac40d0a67551c618b11809f3f8",
+  "spec/acceptance/build_csv.rb": "f28ef587de764ade1513091c4906412c",
+  "spec/acceptance/capitalize_spec.rb": "e77ea2c37144a75a67969c0d0839adfd",
+  "spec/acceptance/chomp_spec.rb": "fb0862a6b7eeb3c290e280788e705061",
+  "spec/acceptance/chop_spec.rb": "4e7ab2d3a441b88b667a0d8ea5b174c1",
+  "spec/acceptance/concat_spec.rb": "3a0dae19a34bb13d406c8e0ec87d8fe5",
+  "spec/acceptance/count_spec.rb": "d82cfcad2461b16872455d6347a8b114",
+  "spec/acceptance/deep_merge_spec.rb": "c335a947f1666e185e0210e661f1c78a",
+  "spec/acceptance/defined_with_params_spec.rb": "f27c54ade9872c63c69316f62b03c119",
+  "spec/acceptance/delete_at_spec.rb": "9c028b703ee0286565c9877757678f3f",
+  "spec/acceptance/delete_spec.rb": "31e6dfcb9cc7c16b20d47c00e6a85a1d",
+  "spec/acceptance/delete_undef_values_spec.rb": "6e6a66aee0c383c843b5f92ef8c8410c",
+  "spec/acceptance/delete_values_spec.rb": "22c9b4914d4cbc0153aa3862cb4fb50e",
+  "spec/acceptance/difference_spec.rb": "289f4f1788feaacb304ffd54971c7e7e",
+  "spec/acceptance/dirname_spec.rb": "84db53878c4400a6c684c924cff05cfc",
+  "spec/acceptance/downcase_spec.rb": "0f094849b94a94df491ee01186473104",
+  "spec/acceptance/empty_spec.rb": "35c1f43e8a3e1fe7dd4335ef86e7efcc",
+  "spec/acceptance/ensure_packages_spec.rb": "de93ff46bcdff523f5636d05b449f6be",
+  "spec/acceptance/ensure_resource_spec.rb": "3e3e9b26ec6cd770469998e3eff49e00",
+  "spec/acceptance/flatten_spec.rb": "83fb08cc168a105c1d5d0df66b1d9e84",
+  "spec/acceptance/floor_spec.rb": "d7267b2914b1da6406224abb7489ca86",
+  "spec/acceptance/fqdn_rotate_spec.rb": "468eed4b9bffa698fbf9219b8ae8435c",
+  "spec/acceptance/get_module_path_spec.rb": "2658cdcd1abd4b7d20f53c4aced3c72a",
+  "spec/acceptance/getparam_spec.rb": "4d32dc5a0ee34d045242c36d77a3b482",
+  "spec/acceptance/getvar_spec.rb": "ba2f081a88be97c0e7004a6296294f23",
+  "spec/acceptance/grep_spec.rb": "98818b8b0557b80d6ff519f70ea7617c",
+  "spec/acceptance/has_interface_with_spec.rb": "30e27096050c43b7efdb5e6c0d54f53b",
+  "spec/acceptance/has_ip_address_spec.rb": "2812117ec4b88556039e8488d53c0cb0",
+  "spec/acceptance/has_ip_network_spec.rb": "ca75b43ff1256ead9052f2db7620db99",
+  "spec/acceptance/has_key_spec.rb": "6509a26a0886f7d591eaa926b2f92407",
+  "spec/acceptance/hash_spec.rb": "1c626457ba056bdd3936e28aa5bf503e",
+  "spec/acceptance/intersection_spec.rb": "40f586af7f95408a5d4a2882a4aa98f1",
+  "spec/acceptance/is_array_spec.rb": "c2ff70ce59b90b50a5aed67abaa5399d",
+  "spec/acceptance/is_bool_spec.rb": "c001fdecff6b0a3c9dc78774987a0b15",
+  "spec/acceptance/is_domain_name_spec.rb": "63e84285c26d8717fd5d4dda01e3f432",
+  "spec/acceptance/is_float_spec.rb": "2f0164b4d732166aa46055a2cf7b4ea9",
+  "spec/acceptance/is_function_available_spec.rb": "7745eba89f8719c9ca7ebf04d5b005f7",
+  "spec/acceptance/is_hash_spec.rb": "cff723cd8fddac45033af5dc8406d4e4",
+  "spec/acceptance/is_integer_spec.rb": "c09201d17d3914bba197872897fa3413",
+  "spec/acceptance/is_ip_address_spec.rb": "aa14cf9abf404c3fe1e761ea957871fe",
+  "spec/acceptance/is_mac_address_spec.rb": "30ff4c6a63be58daa3568305617ca2a7",
+  "spec/acceptance/is_numeric_spec.rb": "fb9829c7a1a8d4a58836df6ff4c3386d",
+  "spec/acceptance/is_string_spec.rb": "df3022de123b72f0022728eb2d8ce857",
+  "spec/acceptance/join_keys_to_values_spec.rb": "8aa128bbaeea65aab8d92badee3ca2b5",
+  "spec/acceptance/join_spec.rb": "c6378ed481265152bba9871fc5501ee6",
+  "spec/acceptance/keys_spec.rb": "20486e3ebee53e50dc9de3b78b9d6ae6",
+  "spec/acceptance/loadyaml_spec.rb": "bd440cb6779026bd07d83f1aceb2781b",
+  "spec/acceptance/lstrip_spec.rb": "e29ab4039b65660ec2bd76a298adcae0",
+  "spec/acceptance/max_spec.rb": "209cda4b83d677743afb1a8870330618",
+  "spec/acceptance/member_spec.rb": "d6088a4fa6321791a3067d9b9cf8914a",
+  "spec/acceptance/merge_spec.rb": "5f168188fa0d6b31ba5b3dac49fb609c",
+  "spec/acceptance/min_spec.rb": "152a7db28434a0d0378561d4f64cddcc",
+  "spec/acceptance/nodesets/centos-59-x64.yml": "57eb3e471b9042a8ea40978c467f8151",
+  "spec/acceptance/nodesets/centos-6-vcloud.yml": "bdf9ce9d3b0f0b4995666ae9d64d878d",
+  "spec/acceptance/nodesets/centos-64-x64-pe.yml": "ec075d95760df3d4702abea1ce0a829b",
+  "spec/acceptance/nodesets/centos-64-x64.yml": "092dd2c588a9f87fa1fb12997c0723ef",
+  "spec/acceptance/nodesets/centos-65-x64.yml": "3e5c36e6aa5a690229e720f4048bb8af",
+  "spec/acceptance/nodesets/default.yml": "3e5c36e6aa5a690229e720f4048bb8af",
+  "spec/acceptance/nodesets/fedora-18-x64.yml": "80e41b1ee16ea489f53164bfdae58855",
+  "spec/acceptance/nodesets/sles-11-x64.yml": "44e4c6c15c018333bfa9840a5e702f66",
+  "spec/acceptance/nodesets/ubuntu-server-10044-x64.yml": "75e86400b7889888dc0781c0ae1a1297",
+  "spec/acceptance/nodesets/ubuntu-server-12042-x64.yml": "d30d73e34cd50b043c7d14e305955269",
+  "spec/acceptance/nodesets/ubuntu-server-1404-x64.yml": "5f0aed10098ac5b78e4217bb27c7aaf0",
+  "spec/acceptance/nodesets/windows-2003-i386.yml": "b518fc01fab99ee6a9afccec5bc0c1c4",
+  "spec/acceptance/nodesets/windows-2003-x86_64.yml": "5c783eaa8ea4734edc836e89e923dfa1",
+  "spec/acceptance/nodesets/windows-2008-x86_64.yml": "3082234eafcfaf7a9579d9ebdb8bc409",
+  "spec/acceptance/nodesets/windows-2008r2-x86_64.yml": "dfeff32a4cc3fffa872c8281d990a840",
+  "spec/acceptance/nodesets/windows-2012-x86_64.yml": "8bed73362ee1f43d21ea1903a729f955",
+  "spec/acceptance/nodesets/windows-2012r2-x86_64.yml": "3f4f6112d24db02989b8ab79d3a1256f",
+  "spec/acceptance/num2bool_spec.rb": "e4a00b913b08c68a689837e9f9336cb2",
+  "spec/acceptance/parsejson_spec.rb": "ea3973d412ad6f72425fdfac6fbb2bb4",
+  "spec/acceptance/parseyaml_spec.rb": "7bbfeed73d0626f69daedfc151957967",
+  "spec/acceptance/pick_default_spec.rb": "1bc2562380ef6f6cded5ec90a03922be",
+  "spec/acceptance/pick_spec.rb": "272c54c8f9398f499768331bdb4276ee",
+  "spec/acceptance/prefix_spec.rb": "da620568c6771e7d492ec1ff697c531c",
+  "spec/acceptance/range_spec.rb": "65e5b98ceca257658604d988fbec7d03",
+  "spec/acceptance/reject_spec.rb": "b5185f1a6071c9bdc7aca92e6f899c3e",
+  "spec/acceptance/reverse_spec.rb": "7bdee543e82532e97bbf7a067140031c",
+  "spec/acceptance/rstrip_spec.rb": "28a64ceb7cb5ae8a93d31f49816190ab",
+  "spec/acceptance/shuffle_spec.rb": "8a8652e57d56f2b4946cdf4d20052b7a",
+  "spec/acceptance/size_spec.rb": "ae17d8a55921a0570972200c7c9327e1",
+  "spec/acceptance/sort_spec.rb": "d44b1b8c090f0f00a2f38515fda431ea",
+  "spec/acceptance/squeeze_spec.rb": "adcd65fa4e72203b97f1f14c8835c2cd",
+  "spec/acceptance/str2bool_spec.rb": "55ad165ceef6b9ba32bf20ca3b53b44c",
+  "spec/acceptance/str2saltedsha512_spec.rb": "b684c4214d06ae3d5bae055262a5ccaa",
+  "spec/acceptance/strftime_spec.rb": "0f4eadbd74445b35de4a42c9790fbcc1",
+  "spec/acceptance/strip_spec.rb": "6767da5bc735beb5362aeee6ff692c9e",
+  "spec/acceptance/suffix_spec.rb": "07dfc7eed48b75fcc1b93d0308243eda",
+  "spec/acceptance/swapcase_spec.rb": "5c3c1bc19a09fed6e01881f79b0b4ea5",
+  "spec/acceptance/time_spec.rb": "044b2f634a1fa6ecc735998d68a93b73",
+  "spec/acceptance/to_bytes_spec.rb": "f9df1f234b9409f5eaf56ef24e651c36",
+  "spec/acceptance/type_spec.rb": "4297e038a8ff7e6ecb859b8b68c7b3a6",
+  "spec/acceptance/union_spec.rb": "b6092941e0574f3c60910bebf84d2844",
+  "spec/acceptance/unique_spec.rb": "9b00b21cefde3b5391f50eeb9cd2493b",
+  "spec/acceptance/unsupported_spec.rb": "09b9265ecb05252cd5e5a18327c7ae97",
+  "spec/acceptance/upcase_spec.rb": "ffd1d6f9e6ec24131fb78983c53a75f9",
+  "spec/acceptance/uriescape_spec.rb": "13daa387714cbfc63b587aaa8dbf7fcd",
+  "spec/acceptance/validate_absolute_path_spec.rb": "8b9ebfae80329231d84fcab606a3eeaf",
+  "spec/acceptance/validate_array_spec.rb": "382641719e754622ffae562d10e38bf7",
+  "spec/acceptance/validate_augeas_spec.rb": "c26b8ca2184a9dd87033a0c6f0553093",
+  "spec/acceptance/validate_bool_spec.rb": "08bc139459204cf0a35098a5bc30ab95",
+  "spec/acceptance/validate_cmd_spec.rb": "e9260c49d880e4de54f77bf4fd70cff4",
+  "spec/acceptance/validate_hash_spec.rb": "70ceacc18a0dee97b26ab2e50f925706",
+  "spec/acceptance/validate_ipv4_address_spec.rb": "dc901bbd05c3764a93cb49154cea6e4b",
+  "spec/acceptance/validate_ipv6_address_spec.rb": "c0872c56230ac2800cd5723eaa5bc53a",
+  "spec/acceptance/validate_re_spec.rb": "b289909078d6ae0d015419f518566698",
+  "spec/acceptance/validate_slength_spec.rb": "f0a05c1c2b895b096cb7326df4821594",
+  "spec/acceptance/validate_string_spec.rb": "6c9ced99fb1e263e66e25427d24f8f7b",
+  "spec/acceptance/values_at_spec.rb": "669b26c4d47742051472003518c3aa61",
+  "spec/acceptance/values_spec.rb": "9681223bb1bd755c28946ef0bcd6ece9",
+  "spec/acceptance/zip_spec.rb": "86d1b555745ee873da68c71f1e46ed21",
+  "spec/classes/anchor_spec.rb": "40600ba2845f9bd360a9504a347f12ba",
+  "spec/functions/abs_spec.rb": "6c3a4f6072cf28132c29ff42791c0d11",
+  "spec/functions/any2array_spec.rb": "2feb23a3615dc55d5e99ae8617f4aca3",
+  "spec/functions/base64_spec.rb": "c93bdf30f5894728fe6558eb24955e26",
+  "spec/functions/bool2num_spec.rb": "12d7f3074beaf3a8b5c06da39b8f5a88",
+  "spec/functions/capitalize_spec.rb": "da52f8dd560b2a2ed57f13019b0b8302",
+  "spec/functions/chomp_spec.rb": "dea81927a4c134e2a47500969324c70e",
+  "spec/functions/chop_spec.rb": "3b0d0335f5e3347b7a9815e58b923657",
+  "spec/functions/concat_spec.rb": "bd6e4ec0d455f69551b7ad724f3d3940",
+  "spec/functions/count_spec.rb": "25e6e666561ced6d644d62bd71a648c6",
+  "spec/functions/deep_merge_spec.rb": "84f4f2cc194de907143ea17a3d40687e",
+  "spec/functions/defined_with_params_spec.rb": "498e064c37bb330dc80420e877e4e57d",
+  "spec/functions/delete_at_spec.rb": "012b3399d4a7101fc4cd4938e9bd2d50",
+  "spec/functions/delete_spec.rb": "0f064eca1423a58b56cead619f260eec",
+  "spec/functions/delete_undef_values_spec.rb": "d61453c547c8816128e0a5e358821248",
+  "spec/functions/delete_values_spec.rb": "737cf476b579fb7b549280eb20d13ae7",
+  "spec/functions/difference_spec.rb": "2d7c07bc8bcb82831fcfe2f2a9958605",
+  "spec/functions/dirname_spec.rb": "bd7a8f3b16d9fa7a2836eeca3d70069f",
+  "spec/functions/downcase_spec.rb": "0864d43eb33e5d46a5943c2d117bfa40",
+  "spec/functions/empty_spec.rb": "046c8206121e364eb9b11bfb378e591b",
+  "spec/functions/ensure_packages_spec.rb": "f1b60599078cdcb3cff1368346108264",
+  "spec/functions/ensure_resource_spec.rb": "7765dde3b9fc54b7dddb6597e0f7b523",
+  "spec/functions/flatten_spec.rb": "a830987eb5b26a1b4325a7737fb9a7e2",
+  "spec/functions/floor_spec.rb": "d53e184f732c7b0fa49664645d6fb63d",
+  "spec/functions/fqdn_rotate_spec.rb": "46ff7d4e643cd42960bcfda145c8aa0d",
+  "spec/functions/get_module_path_spec.rb": "632de3cddb0980998b1f7f819feda3b4",
+  "spec/functions/getparam_spec.rb": "292346901bc0083a983fc166fee44675",
+  "spec/functions/getvar_spec.rb": "e0fa7cde8c415d099cd31888670ca2fc",
+  "spec/functions/grep_spec.rb": "aa5ab60a3899a4286152fbd5d3218bd3",
+  "spec/functions/has_interface_with_spec.rb": "2abef34f38bf2369434f27ab5ab02e0f",
+  "spec/functions/has_ip_address_spec.rb": "89d2a1e161ba9efdec36f90e1b7737bf",
+  "spec/functions/has_ip_network_spec.rb": "b0c080fa6fa27f03a0999a07b4cfbd08",
+  "spec/functions/has_key_spec.rb": "63f35c643a8a0ac1f3281b2981b4ab26",
+  "spec/functions/hash_spec.rb": "f85918bdeb33c2b0dc276fda46528d56",
+  "spec/functions/intersection_spec.rb": "fa5e91bec7bcf48c5d4b66e2824ba629",
+  "spec/functions/is_array_spec.rb": "82266ebdbc4002dc4471eb19095a617d",
+  "spec/functions/is_bool_spec.rb": "f8075f0d7b79b5568a646d97fb4e8115",
+  "spec/functions/is_domain_name_spec.rb": "533fea73283081f95c1196f2b347091c",
+  "spec/functions/is_float_spec.rb": "adf03894b9e78f1e66831ba52ac20f49",
+  "spec/functions/is_function_available.rb": "193666f87f9a739a77335d9171411f5f",
+  "spec/functions/is_hash_spec.rb": "f1906d7cacf56f0ed26f703a3c4e19c4",
+  "spec/functions/is_integer_spec.rb": "5ed8c0620c64a4e8a6a07105816ae1f4",
+  "spec/functions/is_ip_address_spec.rb": "1c3ce0f2f9b6354d6ea7ffa36731d94c",
+  "spec/functions/is_mac_address_spec.rb": "60b1ea6464e10f3c8a095af0b69a1f4a",
+  "spec/functions/is_numeric_spec.rb": "6ceee608830d8d3c37a0d52d253e5ed1",
+  "spec/functions/is_string_spec.rb": "b67b213edc19f0bd97b2e4e561b4688b",
+  "spec/functions/join_keys_to_values_spec.rb": "444289422833c4d932432cba336d79ff",
+  "spec/functions/join_spec.rb": "35fe86a4a49befe39452eb861f3c66ff",
+  "spec/functions/keys_spec.rb": "6ada6f2263dda5a22b0505bab90c1543",
+  "spec/functions/loadyaml_spec.rb": "7d688e8382dd47db93dc4c710f8d6010",
+  "spec/functions/lstrip_spec.rb": "3161f3673f327aed9488958bbb91d720",
+  "spec/functions/max_spec.rb": "0ced8af1760cb387e7b8f4bc014fc94b",
+  "spec/functions/member_spec.rb": "8ac9f5d1aee5b3f503532fd54d9f609d",
+  "spec/functions/merge_spec.rb": "791ea69c46145b9c39f65f8d241a1205",
+  "spec/functions/min_spec.rb": "b13e21751bfacc850019fa4c7c177536",
+  "spec/functions/num2bool_spec.rb": "837bc45de67428a3c1faf8e22bb7dcf1",
+  "spec/functions/parsejson_spec.rb": "76e923a21cc6ddd38edf9a18e52991ae",
+  "spec/functions/parseyaml_spec.rb": "ebc620457c14d268a3f313277ab5ff46",
+  "spec/functions/pick_default_spec.rb": "dbfcee6a55488e8cb0af0866e1297f8c",
+  "spec/functions/pick_spec.rb": "c7ae8b1aa7eb615c9164d3cccfc891fb",
+  "spec/functions/prefix_spec.rb": "8b9202ab77ece34dc6d964e17228484a",
+  "spec/functions/private_spec.rb": "0c0c0ccc8d247e49a73cda07f845b6cc",
+  "spec/functions/range_spec.rb": "17ff3b8d7ead0939519c38d993fe2347",
+  "spec/functions/reject_spec.rb": "12cd8e9b98234dbfca06b33af4152bf3",
+  "spec/functions/reverse_spec.rb": "4dc357880ba5d3716c53d73e2045466a",
+  "spec/functions/rstrip_spec.rb": "af0d0c8b18c772f10e8227b3e9d8a54a",
+  "spec/functions/shuffle_spec.rb": "de716009e14609112b0209570dc69b06",
+  "spec/functions/size_spec.rb": "7551af6a9055650c863431ee6f9c82f5",
+  "spec/functions/sort_spec.rb": "c548fee79b5e86e5371371dbb36982db",
+  "spec/functions/squeeze_spec.rb": "aa7d260c8840e0eb4b72def5e0f63d96",
+  "spec/functions/str2bool_spec.rb": "1b854776e182f528d72f624a581e1a19",
+  "spec/functions/str2saltedsha512_spec.rb": "284430b18af76f42d60ad2db4c5e265a",
+  "spec/functions/strftime_spec.rb": "55b2abeecb65d147136d6af49ce61924",
+  "spec/functions/strip_spec.rb": "ac5316d9357fecba9ac55bdb0eb0ac29",
+  "spec/functions/suffix_spec.rb": "217ff8dc2f509b860af7c7c9ff73134b",
+  "spec/functions/swapcase_spec.rb": "686d6ff7c7a1fd473d2a74a1c3bbe8ca",
+  "spec/functions/time_spec.rb": "1a2db01a57ed1437b19cdeaaabc2c77e",
+  "spec/functions/to_bytes_spec.rb": "f0b0fbb9919bbe3882ca0d8f8db2c3b8",
+  "spec/functions/type_spec.rb": "67d0cd9eebdf68262477b39657915d20",
+  "spec/functions/union_spec.rb": "db5d5a0aa8c29725936e2488ccbcfd0a",
+  "spec/functions/unique_spec.rb": "42f9b82d1df269a1b34f4562369b8b84",
+  "spec/functions/upcase_spec.rb": "a22d1d5e6554a2393203f20e2eac37d0",
+  "spec/functions/uriescape_spec.rb": "e09f0f54dbc8bccddac06236d7920f7c",
+  "spec/functions/validate_absolute_path_spec.rb": "5a0b98675070e511810dab9e60dc43b6",
+  "spec/functions/validate_array_spec.rb": "bcd231229554785c4270ca92ef99cb60",
+  "spec/functions/validate_augeas_spec.rb": "eee1a0c3ef3051bda525b1e17d577ab0",
+  "spec/functions/validate_bool_spec.rb": "7aeb6085fc9601c6bbe6c49e56d209a4",
+  "spec/functions/validate_cmd_spec.rb": "efc88e8e21481acd36c7f948b1f226ea",
+  "spec/functions/validate_hash_spec.rb": "8529c74051ceb71e6b1b97c9cecdf625",
+  "spec/functions/validate_ipv4_address_spec.rb": "19f2f44fbbdf7a2e69aeaa2f0f402695",
+  "spec/functions/validate_ipv6_address_spec.rb": "2d8617be4405bdbd84d140ba8be6c184",
+  "spec/functions/validate_re_spec.rb": "d8ab477f9afcb748f144588ebb3a28a3",
+  "spec/functions/validate_slength_spec.rb": "438738f1ac9363d5a7cd8c3ee09fe14c",
+  "spec/functions/validate_string_spec.rb": "64a4f681084cba55775a070f7fab5e0c",
+  "spec/functions/values_at_spec.rb": "cdfc313cc283400f1aed75f4cbd0ab4f",
+  "spec/functions/values_spec.rb": "2ea5dd37e6ac9c89f4b434c7ed7cc45e",
+  "spec/functions/zip_spec.rb": "d67e3424e60de00ff26e73516f4bf6da",
+  "spec/lib/puppet_spec/compiler.rb": "3c1f03dd8ac2f6f90d7e8f879a3ce4c0",
+  "spec/lib/puppet_spec/database.rb": "c74c0cf62980beea88c7749f876ccfa7",
+  "spec/lib/puppet_spec/files.rb": "906da85e399302cee403e10e357d3f4c",
+  "spec/lib/puppet_spec/fixtures.rb": "0722c5ccbfcba1fc27da1900e54b4463",
+  "spec/lib/puppet_spec/matchers.rb": "dd30ba6b936e8c267511d67acb087c35",
+  "spec/lib/puppet_spec/modules.rb": "445d2739aa8754568a14816280727d70",
+  "spec/lib/puppet_spec/pops.rb": "adf661defa460b7189e3750535533d34",
+  "spec/lib/puppet_spec/scope.rb": "01aeb89bdc2d29a2528ced26ec6402ec",
+  "spec/lib/puppet_spec/settings.rb": "5da4e0dad8bf6b21cc4437c73753a56d",
+  "spec/lib/puppet_spec/verbose.rb": "71dbccd9a45ed89d12fd1c44456a6820",
+  "spec/monkey_patches/alias_should_to_must.rb": "b19ee31563afb91a72f9869f9d7362ff",
+  "spec/monkey_patches/publicize_methods.rb": "c690e444b77c871375d321e413e28ca1",
+  "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
+  "spec/spec_helper.rb": "b7a797512ad4ae4395fa5d1ff524e1f0",
+  "spec/spec_helper_acceptance.rb": "ffb989c77153f8206c9be08f32278147",
+  "spec/unit/facter/facter_dot_d_spec.rb": "420339a544851f2c7ee6fa4c651bdce8",
+  "spec/unit/facter/pe_version_spec.rb": "af4d4428a7625a19de1751ce1bb09d5c",
+  "spec/unit/facter/root_home_spec.rb": "2dabfc67279e85714e0d4479bd149e78",
+  "spec/unit/facter/util/puppet_settings_spec.rb": "7b4afdfe4b80ee6463564bda2c4af344",
+  "spec/unit/puppet/parser/functions/bool2str_spec.rb": "c0a7f753889d0e65c25db5b0eebad7ac",
+  "spec/unit/puppet/parser/functions/camelcase_spec.rb": "332621f98485c651b281aa4b5ac82b5d",
+  "spec/unit/puppet/provider/file_line/ruby_spec.rb": "03b43eac27a171529c6d31595933a802",
+  "spec/unit/puppet/type/anchor_spec.rb": "06a669dffa44d716bf19b4e7f5f1d75d",
+  "spec/unit/puppet/type/file_line_spec.rb": "5800799a8d3aed42c6fb6cf3ea574e07",
+  "tests/file_line.pp": "67727539aa7b7dd76f06626fe734f7f7",
+  "tests/has_interface_with.pp": "59c98b4af0d39fc11d1ef4c7a6dc8f7a",
+  "tests/has_ip_address.pp": "93ce02915f67ddfb43a049b2b84ef391",
+  "tests/has_ip_network.pp": "abc05686797a776ea8c054657e6f7456",
+  "tests/init.pp": "1d98070412c76824e66db4b7eb74d433"
+}
\ No newline at end of file
--- a/modules/stdlib/lib/facter/facter_dot_d.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/facter/facter_dot_d.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -15,7 +15,7 @@
 class Facter::Util::DotD
   require 'yaml'
 
-  def initialize(dir="/etc/facts.d", cache_file="/tmp/facts_cache.yml")
+  def initialize(dir="/etc/facts.d", cache_file=File.join(Puppet[:libdir], "facts_dot_d.cache"))
     @dir = dir
     @cache_file = cache_file
     @cache = nil
@@ -23,7 +23,7 @@
   end
 
   def entries
-    Dir.entries(@dir).reject{|f| f =~ /^\.|\.ttl$/}.sort.map {|f| File.join(@dir, f) }
+    Dir.entries(@dir).reject { |f| f =~ /^\.|\.ttl$/ }.sort.map { |f| File.join(@dir, f) }
   rescue
     []
   end
@@ -40,7 +40,7 @@
 
   def txt_parser(file)
     File.readlines(file).each do |line|
-      if line =~ /^(.+)=(.+)$/
+      if line =~ /^([^=]+)=(.+)$/
         var = $1; val = $2
 
         Facter.add(var) do
@@ -113,7 +113,7 @@
 
   def cache_save!
     cache = load_cache
-    File.open(@cache_file, "w", 0600) {|f| f.write(YAML.dump(cache)) }
+    File.open(@cache_file, "w", 0600) { |f| f.write(YAML.dump(cache)) }
   rescue
   end
 
--- a/modules/stdlib/lib/facter/root_home.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/facter/root_home.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -17,3 +17,16 @@
 Facter.add(:root_home) do
   setcode { Facter::Util::RootHome.get_root_home }
 end
+
+Facter.add(:root_home) do
+  confine :kernel => :darwin
+  setcode do
+    str = Facter::Util::Resolution.exec("dscacheutil -q user -a name root")
+    hash = {}
+    str.split("\n").each do |pair|
+      key,value = pair.split(/:/)
+      hash[key] = value
+    end
+    hash['dir'].strip
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/base64.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,37 @@
+module Puppet::Parser::Functions
+
+  newfunction(:base64, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
+
+    Base64 encode or decode a string based on the command and the string submitted
+
+    Usage:
+
+      $encodestring = base64('encode','thestring')
+      $decodestring = base64('decode','dGhlc3RyaW5n')
+
+    ENDHEREDOC
+
+    require 'base64'
+
+    raise Puppet::ParseError, ("base64(): Wrong number of arguments (#{args.length}; must be = 2)") unless args.length == 2
+
+    actions = ['encode','decode']
+
+    unless actions.include?(args[0])
+      raise Puppet::ParseError, ("base64(): the first argument must be one of 'encode' or 'decode'")
+    end
+
+    unless args[1].is_a?(String)
+      raise Puppet::ParseError, ("base64(): the second argument must be a string to base64")
+    end
+
+    case args[0]
+      when 'encode'
+        result = Base64.encode64(args[1])
+      when 'decode'
+        result = Base64.decode64(args[1])
+    end
+
+    return result
+  end
+end
--- a/modules/stdlib/lib/puppet/parser/functions/bool2num.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/bool2num.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -14,30 +14,7 @@
     raise(Puppet::ParseError, "bool2num(): Wrong number of arguments " +
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
-    value = arguments[0]
-    klass = value.class
-
-    # We can have either true or false, or string which resembles boolean ...
-    unless [FalseClass, TrueClass, String].include?(klass)
-      raise(Puppet::ParseError, 'bool2num(): Requires either ' +
-        'boolean or string to work with')
-    end
-
-    if value.is_a?(String)
-      # We consider all the yes, no, y, n and so on too ...
-      value = case value
-        #
-        # This is how undef looks like in Puppet ...
-        # We yield 0 (or false if you wish) in this case.
-        #
-        when /^$/, '' then false # Empty string will be false ...
-        when /^(1|t|y|true|yes)$/  then true
-        when /^(0|f|n|false|no)$/  then false
-        when /^(undef|undefined)$/ then false # This is not likely to happen ...
-        else
-          raise(Puppet::ParseError, 'bool2num(): Unknown type of boolean given')
-      end
-    end
+    value = function_str2bool([arguments[0]])
 
     # We have real boolean values as well ...
     result = value ? 1 : 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/bool2str.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#
+# bool2str.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:bool2str, :type => :rvalue, :doc => <<-EOS
+    Converts a boolean to a string.
+    Requires a single boolean as an input.
+    EOS
+  ) do |arguments|
+
+    raise(Puppet::ParseError, "bool2str(): Wrong number of arguments " +
+      "given (#{arguments.size} for 1)") if arguments.size < 1
+
+    value = arguments[0]
+    klass = value.class
+
+    # We can have either true or false, and nothing else
+    unless [FalseClass, TrueClass].include?(klass)
+      raise(Puppet::ParseError, 'bool2str(): Requires a boolean to work with')
+    end
+
+    return value.to_s
+  end
+end
+
+# vim: set ts=2 sw=2 et :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/camelcase.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#
+#  camelcase.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:camelcase, :type => :rvalue, :doc => <<-EOS
+Converts the case of a string or all strings in an array to camel case.
+    EOS
+  ) do |arguments|
+
+    raise(Puppet::ParseError, "camelcase(): Wrong number of arguments " +
+      "given (#{arguments.size} for 1)") if arguments.size < 1
+
+    value = arguments[0]
+    klass = value.class
+
+    unless [Array, String].include?(klass)
+      raise(Puppet::ParseError, 'camelcase(): Requires either ' +
+        'array or string to work with')
+    end
+
+    if value.is_a?(Array)
+      # Numbers in Puppet are often string-encoded which is troublesome ...
+      result = value.collect { |i| i.is_a?(String) ? i.split('_').map{|e| e.capitalize}.join : i }
+    else
+      result = value.split('_').map{|e| e.capitalize}.join
+    end
+
+    return result
+  end
+end
+
+# vim: set ts=2 sw=2 et :
--- a/modules/stdlib/lib/puppet/parser/functions/capitalize.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/capitalize.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -13,9 +13,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'capitalize(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/chomp.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/chomp.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -14,9 +14,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'chomp(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/chop.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/chop.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -16,9 +16,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'chop(): Requires either an ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/concat.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/concat.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -23,12 +23,12 @@
     a = arguments[0]
     b = arguments[1]
 
-    # Check that both args are arrays.
-    unless a.is_a?(Array) and b.is_a?(Array)
+    # Check that the first parameter is an array
+    unless a.is_a?(Array)
       raise(Puppet::ParseError, 'concat(): Requires array to work with')
     end
 
-    result = a.concat(b)
+    result = a + Array(b)
 
     return result
   end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,44 @@
+module Puppet::Parser::Functions
+  newfunction(:deep_merge, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
+    Recursively merges two or more hashes together and returns the resulting hash.
+
+    For example:
+
+        $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+        $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+        $merged_hash = deep_merge($hash1, $hash2)
+        # The resulting hash is equivalent to:
+        # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
+
+    When there is a duplicate key that is a hash, they are recursively merged.
+    When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
+
+    ENDHEREDOC
+
+    if args.length < 2
+      raise Puppet::ParseError, ("deep_merge(): wrong number of arguments (#{args.length}; must be at least 2)")
+    end
+
+    deep_merge = Proc.new do |hash1,hash2|
+      hash1.merge(hash2) do |key,old_value,new_value|
+        if old_value.is_a?(Hash) && new_value.is_a?(Hash)
+          deep_merge.call(old_value, new_value)
+        else
+          new_value
+        end
+      end
+    end
+
+    result = Hash.new
+    args.each do |arg|
+      next if arg.is_a? String and arg.empty? # empty string is synonym for puppet's undef
+      # If the argument was not a hash, skip it.
+      unless arg.is_a?(Hash)
+        raise Puppet::ParseError, "deep_merge: unexpected argument type #{arg.class}, only expects hash arguments"
+      end
+
+      result = deep_merge.call(result, arg)
+    end
+    return( result )
+  end
+end
--- a/modules/stdlib/lib/puppet/parser/functions/delete.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/delete.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -27,7 +27,7 @@
         "given #{arguments.size} for 2.")
     end
 
-    collection = arguments[0]
+    collection = arguments[0].dup
     item = arguments[1]
 
     case collection
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+module Puppet::Parser::Functions
+  newfunction(:delete_undef_values, :type => :rvalue, :doc => <<-EOS
+Returns a copy of input hash or array with all undefs deleted.
+
+*Examples:*
+
+    $hash = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})
+
+Would return: {a => 'A', b => '', d => false}
+
+    $array = delete_undef_values(['A','',undef,false])
+
+Would return: ['A','',false]
+
+      EOS
+    ) do |args|
+
+    raise(Puppet::ParseError,
+          "delete_undef_values(): Wrong number of arguments given " +
+          "(#{args.size})") if args.size < 1
+
+    unless args[0].is_a? Array or args[0].is_a? Hash
+      raise(Puppet::ParseError,
+            "delete_undef_values(): expected an array or hash, got #{args[0]} type  #{args[0].class} ")
+    end
+    result = args[0].dup
+    if result.is_a?(Hash)
+      result.delete_if {|key, val| val.equal? :undef}
+    elsif result.is_a?(Array)
+      result.delete :undef
+    end
+    result
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/delete_values.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+module Puppet::Parser::Functions
+  newfunction(:delete_values, :type => :rvalue, :doc => <<-EOS
+Deletes all instances of a given value from a hash.
+
+*Examples:*
+
+    delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')
+
+Would return: {'a'=>'A','c'=>'C','B'=>'D'}
+
+      EOS
+    ) do |arguments|
+
+    raise(Puppet::ParseError,
+          "delete_values(): Wrong number of arguments given " +
+          "(#{arguments.size} of 2)") if arguments.size != 2
+
+    hash, item = arguments
+
+    if not hash.is_a?(Hash)
+      raise(TypeError, "delete_values(): First argument must be a Hash. " + \
+                       "Given an argument of class #{hash.class}.")
+    end
+    hash.dup.delete_if { |key, val| item == val }
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/difference.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,36 @@
+#
+# difference.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:difference, :type => :rvalue, :doc => <<-EOS
+This function returns the difference between two arrays.
+The returned array is a copy of the original array, removing any items that
+also appear in the second array.
+
+*Examples:*
+
+    difference(["a","b","c"],["b","c","d"])
+
+Would return: ["a"]
+    EOS
+  ) do |arguments|
+
+    # Two arguments are required
+    raise(Puppet::ParseError, "difference(): Wrong number of arguments " +
+      "given (#{arguments.size} for 2)") if arguments.size != 2
+
+    first = arguments[0]
+    second = arguments[1]
+
+    unless first.is_a?(Array) && second.is_a?(Array)
+      raise(Puppet::ParseError, 'difference(): Requires 2 arrays')
+    end
+
+    result = first - second
+
+    return result
+  end
+end
+
+# vim: set ts=2 sw=2 et :
--- a/modules/stdlib/lib/puppet/parser/functions/downcase.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/downcase.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,9 +12,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'downcase(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/empty.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/empty.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,9 +12,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, Hash, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String)
       raise(Puppet::ParseError, 'empty(): Requires either ' +
         'array, hash or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,22 +1,33 @@
 #
 # ensure_packages.rb
 #
-require 'puppet/parser/functions'
 
 module Puppet::Parser::Functions
   newfunction(:ensure_packages, :type => :statement, :doc => <<-EOS
 Takes a list of packages and only installs them if they don't already exist.
+It optionally takes a hash as a second parameter that will be passed as the
+third argument to the ensure_resource() function.
     EOS
   ) do |arguments|
 
-    raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments " +
-      "given (#{arguments.size} for 1)") if arguments.size != 1
-    raise(Puppet::ParseError, "ensure_packages(): Requires array " +
-      "given (#{arguments[0].class})") if !arguments[0].kind_of?(Array)
+    if arguments.size > 2 or arguments.size == 0
+      raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments " +
+        "given (#{arguments.size} for 1 or 2)")
+    elsif arguments.size == 2 and !arguments[1].is_a?(Hash) 
+      raise(Puppet::ParseError, 'ensure_packages(): Requires second argument to be a Hash')
+    end
+
+    packages = Array(arguments[0])
+
+    if arguments[1]
+      defaults = { 'ensure' => 'present' }.merge(arguments[1])
+    else
+      defaults = { 'ensure' => 'present' }
+    end
 
     Puppet::Parser::Functions.function(:ensure_resource)
-    arguments[0].each { |package_name|
-      function_ensure_resource(['package', package_name, {'ensure' => 'present' } ])
+    packages.each { |package_name|
+      function_ensure_resource(['package', package_name, defaults ])
     }
   end
 end
--- a/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -13,7 +13,7 @@
 
 This example only creates the resource if it does not already exist:
 
-    ensure_resource('user, 'dan', {'ensure' => 'present' })
+    ensure_resource('user', 'dan', {'ensure' => 'present' })
 
 If the resource already exists but does not match the specified parameters,
 this function will attempt to recreate the resource leading to a duplicate
--- a/modules/stdlib/lib/puppet/parser/functions/floor.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/floor.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -8,7 +8,12 @@
     raise(Puppet::ParseError, "floor(): Wrong number of arguments " +
           "given (#{arguments.size} for 1)") if arguments.size != 1
 
-    arg = arguments[0]
+    begin
+      arg = Float(arguments[0])
+    rescue TypeError, ArgumentError => e
+      raise(Puppet::ParseError, "floor(): Wrong argument type " +
+            "given (#{arguments[0]} for Numeric)")
+    end
 
     raise(Puppet::ParseError, "floor(): Wrong argument type " +
           "given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false
--- a/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,10 +12,9 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
     require 'digest/md5'
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'fqdn_rotate(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/getvar.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/getvar.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -19,7 +19,10 @@
       raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)")
     end
 
-    self.lookupvar("#{args[0]}")
+    begin
+      self.lookupvar("#{args[0]}")
+    rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
+    end
 
   end
 
--- a/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -25,7 +25,7 @@
     interfaces = lookupvar('interfaces')
 
     # If we do not have any interfaces, then there are no requested attributes
-    return false if (interfaces == :undefined)
+    return false if (interfaces == :undefined || interfaces.nil?)
 
     interfaces = interfaces.split(',')
 
@@ -35,13 +35,29 @@
 
     kind, value = args
 
-    if lookupvar(kind) == value
+    # Bug with 3.7.1 - 3.7.3  when using future parser throws :undefined_variable
+    # https://tickets.puppetlabs.com/browse/PUP-3597
+    factval = nil
+    catch :undefined_variable do
+      factval = lookupvar(kind)
+    end
+    if factval == value
       return true
     end
 
     result = false
     interfaces.each do |iface|
-      if value == lookupvar("#{kind}_#{iface}")
+      iface.downcase!
+      factval = nil
+      begin
+        # Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
+        # https://tickets.puppetlabs.com/browse/PUP-3597
+        catch :undefined_variable do
+          factval = lookupvar("#{kind}_#{iface}")
+        end
+      rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
+      end
+      if value == factval
         result = true
         break
       end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/intersection.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#
+# intersection.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:intersection, :type => :rvalue, :doc => <<-EOS
+This function returns an array an intersection of two.
+
+*Examples:*
+
+    intersection(["a","b","c"],["b","c","d"])
+
+Would return: ["b","c"]
+    EOS
+  ) do |arguments|
+
+    # Two arguments are required
+    raise(Puppet::ParseError, "intersection(): Wrong number of arguments " +
+      "given (#{arguments.size} for 2)") if arguments.size != 2
+
+    first = arguments[0]
+    second = arguments[1]
+
+    unless first.is_a?(Array) && second.is_a?(Array)
+      raise(Puppet::ParseError, 'intersection(): Requires 2 arrays')
+    end
+
+    result = first & second
+
+    return result
+  end
+end
+
+# vim: set ts=2 sw=2 et :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/is_bool.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#
+# is_bool.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:is_bool, :type => :rvalue, :doc => <<-EOS
+Returns true if the variable passed to this function is a boolean.
+    EOS
+  ) do |arguments|
+
+    raise(Puppet::ParseError, "is_bool(): Wrong number of arguments " +
+      "given (#{arguments.size} for 1)") if arguments.size != 1
+
+    type = arguments[0]
+
+    result = type.is_a?(TrueClass) || type.is_a?(FalseClass)
+
+    return result
+  end
+end
+
+# vim: set ts=2 sw=2 et :
--- a/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -20,6 +20,9 @@
     label_min_length=1
     label_max_length=63
 
+    # Only allow string types
+    return false unless domain.is_a?(String)
+
     # Allow ".", it is the top level domain
     return true if domain == '.'
 
--- a/modules/stdlib/lib/puppet/parser/functions/is_float.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/is_float.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -15,6 +15,9 @@
 
     value = arguments[0]
 
+    # Only allow Numeric or String types
+    return false unless value.is_a?(Numeric) or value.is_a?(String)
+
     if value != value.to_f.to_s and !value.is_a? Float then
       return false
     else
--- a/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -15,6 +15,9 @@
         "given #{arguments.size} for 1")
     end
 
+    # Only allow String types
+    return false unless arguments[0].is_a?(String)
+
     function = Puppet::Parser::Functions.function(arguments[0].to_sym)
     function.is_a?(String) and not function.empty?
   end
--- a/modules/stdlib/lib/puppet/parser/functions/is_integer.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/is_integer.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -4,7 +4,12 @@
 
 module Puppet::Parser::Functions
   newfunction(:is_integer, :type => :rvalue, :doc => <<-EOS
-Returns true if the variable returned to this string is an integer.
+Returns true if the variable passed to this function is an Integer or
+a decimal (base 10) integer in String form. The string may
+start with a '-' (minus). A value of '0' is allowed, but a leading '0' digit may not
+be followed by other digits as this indicates that the value is octal (base 8).
+
+If given any other argument `false` is returned.
     EOS
   ) do |arguments|
 
@@ -15,12 +20,25 @@
 
     value = arguments[0]
 
-    if value != value.to_i.to_s and !value.is_a? Fixnum then
-      return false
+    # Regex is taken from the lexer of puppet
+    # puppet/pops/parser/lexer.rb but modified to match also
+    # negative values and disallow numbers prefixed with multiple
+    # 0's
+    #
+    # TODO these parameter should be a constant but I'm not sure
+    # if there is no risk to declare it inside of the module
+    # Puppet::Parser::Functions
+
+    # Integer numbers like
+    # -1234568981273
+    # 47291
+    numeric = %r{^-?(?:(?:[1-9]\d*)|0)$}
+
+    if value.is_a? Integer or (value.is_a? String and value.match numeric)
+      return true
     else
-      return true
+      return false
     end
-
   end
 end
 
--- a/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -4,7 +4,23 @@
 
 module Puppet::Parser::Functions
   newfunction(:is_numeric, :type => :rvalue, :doc => <<-EOS
-Returns true if the variable passed to this function is a number.
+Returns true if the given argument is a Numeric (Integer or Float),
+or a String containing either a valid integer in decimal base 10 form, or
+a valid floating point string representation.
+
+The function recognizes only decimal (base 10) integers and float but not
+integers in hex (base 16) or octal (base 8) form.
+
+The string representation may start with a '-' (minus). If a decimal '.' is used,
+it must be followed by at least one digit.
+
+Valid examples:
+
+  77435
+  10e-12
+  -8475
+  0.2343
+  -23.561e3
     EOS
   ) do |arguments|
 
@@ -15,12 +31,44 @@
 
     value = arguments[0]
 
-    if value == value.to_f.to_s or value == value.to_i.to_s or value.is_a? Numeric then
+    # Regex is taken from the lexer of puppet
+    # puppet/pops/parser/lexer.rb but modified to match also
+    # negative values and disallow invalid octal numbers or
+    # numbers prefixed with multiple 0's (except in hex numbers)
+    #
+    # TODO these parameters should be constants but I'm not sure
+    # if there is no risk to declare them inside of the module
+    # Puppet::Parser::Functions
+
+    # TODO decide if this should be used
+    # HEX numbers like
+    # 0xaa230F
+    # 0X1234009C
+    # 0x0012
+    # -12FcD
+    #numeric_hex = %r{^-?0[xX][0-9A-Fa-f]+$}
+
+    # TODO decide if this should be used
+    # OCTAL numbers like
+    # 01234567
+    # -045372
+    #numeric_oct = %r{^-?0[1-7][0-7]*$}
+
+    # Integer/Float numbers like
+    # -0.1234568981273
+    # 47291
+    # 42.12345e-12
+    numeric = %r{^-?(?:(?:[1-9]\d*)|0)(?:\.\d+)?(?:[eE]-?\d+)?$}
+
+    if value.is_a? Numeric or (value.is_a? String and (
+      value.match(numeric) #or
+    #  value.match(numeric_hex) or
+    #  value.match(numeric_oct)
+    ))
       return true
     else
       return false
     end
-
   end
 end
 
--- a/modules/stdlib/lib/puppet/parser/functions/join.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/join.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -4,7 +4,7 @@
 
 module Puppet::Parser::Functions
   newfunction(:join, :type => :rvalue, :doc => <<-EOS
-This function joins an array into a string using a seperator.
+This function joins an array into a string using a separator.
 
 *Examples:*
 
--- a/modules/stdlib/lib/puppet/parser/functions/lstrip.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/lstrip.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,9 +12,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'lstrip(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/member.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/member.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -8,6 +8,7 @@
 module Puppet::Parser::Functions
   newfunction(:member, :type => :rvalue, :doc => <<-EOS
 This function determines if a variable is a member of an array.
+The variable can be a string, fixnum, or array.
 
 *Examples:*
 
@@ -15,9 +16,17 @@
 
 Would return: true
 
+    member(['a', 'b', 'c'], ['a', 'b'])
+
+would return: true
+
     member(['a','b'], 'c')
 
 Would return: false
+
+    member(['a', 'b', 'c'], ['d', 'b'])
+
+would return: false
     EOS
   ) do |arguments|
 
@@ -30,12 +39,21 @@
       raise(Puppet::ParseError, 'member(): Requires array to work with')
     end
 
-    item = arguments[1]
+    unless arguments[1].is_a? String or arguments[1].is_a? Fixnum or arguments[1].is_a? Array
+      raise(Puppet::ParseError, 'member(): Item to search for must be a string, fixnum, or array')
+    end
+
+    if arguments[1].is_a? String or arguments[1].is_a? Fixnum
+      item = Array(arguments[1])
+    else
+      item = arguments[1]
+    end
+
 
     raise(Puppet::ParseError, 'member(): You must provide item ' +
-      'to search for within array given') if item.empty?
+      'to search for within array given') if item.respond_to?('empty?') && item.empty?
 
-    result = array.include?(item)
+    result = (item - array).empty?
 
     return result
   end
--- a/modules/stdlib/lib/puppet/parser/functions/merge.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/merge.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -22,6 +22,7 @@
     accumulator = Hash.new
     # Merge into the accumulator hash
     args.each do |arg|
+      next if arg.is_a? String and arg.empty? # empty string is synonym for puppet's undef
       unless arg.is_a?(Hash)
         raise Puppet::ParseError, "merge: unexpected argument type #{arg.class}, only expects hash arguments"
       end
--- a/modules/stdlib/lib/puppet/parser/functions/pick.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/pick.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -21,7 +21,7 @@
    args.delete(:undefined)
    args.delete("")
    if args[0].to_s.empty? then
-     fail "Must provide non empty value."
+     fail Puppet::ParseError, "pick(): must receive at least one non empty value"
    else
      return args[0]
    end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/pick_default.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,35 @@
+module Puppet::Parser::Functions
+ newfunction(:pick_default, :type => :rvalue, :doc => <<-EOS
+
+This function is similar to a coalesce function in SQL in that it will return
+the first value in a list of values that is not undefined or an empty string
+(two things in Puppet that will return a boolean false value). If no value is
+found, it will return the last argument.
+
+Typically, this function is used to check for a value in the Puppet
+Dashboard/Enterprise Console, and failover to a default value like the
+following:
+
+  $real_jenkins_version = pick_default($::jenkins_version, '1.449')
+
+The value of $real_jenkins_version will first look for a top-scope variable
+called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
+Enterprise Console are brought into Puppet as top-scope variables), and,
+failing that, will use a default value of 1.449.
+
+Note that, contrary to the pick() function, the pick_default does not fail if
+all arguments are empty. This allows pick_default to use an empty value as
+default.
+
+EOS
+) do |args|
+   fail "Must receive at least one argument." if args.empty?
+   default = args.last
+   args = args[0..-2].compact
+   args.delete(:undef)
+   args.delete(:undefined)
+   args.delete("")
+   args << default
+   return args[0]
+ end
+end
--- a/modules/stdlib/lib/puppet/parser/functions/prefix.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/prefix.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -28,7 +28,7 @@
 
     if prefix
       unless prefix.is_a?(String)
-        raise Puppet::ParseError, "prefix(): expected second argument to be a String, got #{suffix.inspect}"
+        raise Puppet::ParseError, "prefix(): expected second argument to be a String, got #{prefix.inspect}"
       end
     end
 
--- a/modules/stdlib/lib/puppet/parser/functions/range.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/range.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -27,6 +27,13 @@
     range("host01", "host10")
 
 Will return: ["host01", "host02", ..., "host09", "host10"]
+
+Passing a third argument will cause the generated range to step by that
+interval, e.g.
+
+    range("0", "9", "2")
+
+Will return: [0,2,4,6,8]
     EOS
   ) do |arguments|
 
@@ -37,6 +44,7 @@
     if arguments.size > 1
       start = arguments[0]
       stop  = arguments[1]
+      step  = arguments[2].nil? ? 1 : arguments[2].to_i.abs
 
       type = '..' # We select simplest type for Range available in Ruby ...
 
@@ -57,21 +65,21 @@
       end
     end
 
-      # Check whether we have integer value if so then make it so ...
-      if start.match(/^\d+$/)
-        start = start.to_i
-        stop  = stop.to_i
-      else
-        start = start.to_s
-        stop  = stop.to_s
-      end
+    # Check whether we have integer value if so then make it so ...
+    if start.to_s.match(/^\d+$/)
+      start = start.to_i
+      stop  = stop.to_i
+    else
+      start = start.to_s
+      stop  = stop.to_s
+    end
 
-      range = case type
-        when /^(\.\.|\-)$/ then (start .. stop)
-        when /^(\.\.\.)$/  then (start ... stop) # Exclusive of last element ...
-      end
+    range = case type
+      when /^(\.\.|\-)$/ then (start .. stop)
+      when /^(\.\.\.)$/  then (start ... stop) # Exclusive of last element ...
+    end
 
-      result = range.collect { |i| i } # Get them all ... Pokemon ...
+    result = range.step(step).collect { |i| i } # Get them all ... Pokemon ...
 
     return result
   end
--- a/modules/stdlib/lib/puppet/parser/functions/reverse.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/reverse.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,9 +12,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'reverse(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/rstrip.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/rstrip.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,9 +12,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'rstrip(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/shuffle.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/shuffle.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -12,9 +12,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'shuffle(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/str2bool.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/str2bool.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -14,7 +14,7 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     string = arguments[0]
-    
+
     # If string is already Boolean, return it
     if !!string == string
       return string
--- a/modules/stdlib/lib/puppet/parser/functions/strip.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/strip.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -19,9 +19,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'strip(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/swapcase.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/swapcase.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -18,9 +18,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'swapcase(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -2,6 +2,8 @@
   newfunction(:to_bytes, :type => :rvalue, :doc => <<-EOS
     Converts the argument into bytes, for example 4 kB becomes 4096.
     Takes a single string value as an argument.
+    These conversions reflect a layperson's understanding of
+    1 MB = 1024 KB, when in fact 1 MB = 1000 KB, and 1 MiB = 1024 KiB.
     EOS
   ) do |arguments|
 
@@ -21,7 +23,8 @@
     when 'M' then return (value*(1<<20)).to_i
     when 'G' then return (value*(1<<30)).to_i
     when 'T' then return (value*(1<<40)).to_i
-    when 'E' then return (value*(1<<50)).to_i
+    when 'P' then return (value*(1<<50)).to_i
+    when 'E' then return (value*(1<<60)).to_i
     else raise Puppet::ParseError, "to_bytes(): Unknown prefix #{prefix}"
     end
   end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/union.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#
+# union.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:union, :type => :rvalue, :doc => <<-EOS
+This function returns a union of two arrays.
+
+*Examples:*
+
+    union(["a","b","c"],["b","c","d"])
+
+Would return: ["a","b","c","d"]
+    EOS
+  ) do |arguments|
+
+    # Two arguments are required
+    raise(Puppet::ParseError, "union(): Wrong number of arguments " +
+      "given (#{arguments.size} for 2)") if arguments.size != 2
+
+    first = arguments[0]
+    second = arguments[1]
+
+    unless first.is_a?(Array) && second.is_a?(Array)
+      raise(Puppet::ParseError, 'union(): Requires 2 arrays')
+    end
+
+    result = first | second
+
+    return result
+  end
+end
+
+# vim: set ts=2 sw=2 et :
--- a/modules/stdlib/lib/puppet/parser/functions/unique.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/unique.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -28,9 +28,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'unique(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/upcase.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/upcase.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -20,9 +20,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'upcase(): Requires either ' +
         'array or string to work with')
     end
--- a/modules/stdlib/lib/puppet/parser/functions/uriescape.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/uriescape.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -14,10 +14,8 @@
       "given (#{arguments.size} for 1)") if arguments.size < 1
 
     value = arguments[0]
-    klass = value.class
-    unsafe = ":/?#[]@!$&'()*+,;= "
 
-    unless [Array, String].include?(klass)
+    unless value.is_a?(Array) || value.is_a?(String)
       raise(Puppet::ParseError, 'uriescape(): Requires either ' +
         'array or string to work with')
     end
@@ -26,7 +24,7 @@
       # Numbers in Puppet are often string-encoded which is troublesome ...
       result = value.collect { |i| i.is_a?(String) ? URI.escape(i,unsafe) : i }
     else
-      result = URI.escape(value,unsafe)
+      result = URI.escape(value)
     end
 
     return result
--- a/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,3 +1,5 @@
+require 'tempfile'
+
 module Puppet::Parser::Functions
   newfunction(:validate_augeas, :doc => <<-'ENDHEREDOC') do |args|
     Perform validation of a string using an Augeas lens
--- a/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -24,7 +24,7 @@
     end
 
     args.each do |arg|
-      unless (arg.is_a?(TrueClass) || arg.is_a?(FalseClass))
+      unless function_is_bool([arg])
         raise Puppet::ParseError, ("#{arg.inspect} is not a boolean.  It looks to be a #{arg.class}")
       end
     end
--- a/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,4 +1,5 @@
 require 'puppet/util/execution'
+require 'tempfile'
 
 module Puppet::Parser::Functions
   newfunction(:validate_cmd, :doc => <<-'ENDHEREDOC') do |args|
@@ -32,6 +33,7 @@
     tmpfile = Tempfile.new("validate_cmd")
     begin
       tmpfile.write(content)
+      tmpfile.close
       if Puppet::Util::Execution.respond_to?('execute')
         Puppet::Util::Execution.execute("#{checkscript} #{tmpfile.path}")
       else
@@ -40,6 +42,9 @@
     rescue Puppet::ExecutionFailure => detail
       msg += "\n#{detail}"
       raise Puppet::ParseError, msg
+    rescue Exception => detail
+      msg += "\n#{detail.class.name} #{detail}"
+      raise Puppet::ParseError, msg
     ensure
       tmpfile.unlink
     end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,48 @@
+module Puppet::Parser::Functions
+
+  newfunction(:validate_ipv4_address, :doc => <<-ENDHEREDOC
+    Validate that all values passed are valid IPv4 addresses.
+    Fail compilation if any value fails this check.
+
+    The following values will pass:
+
+    $my_ip = "1.2.3.4"
+    validate_ipv4_address($my_ip)
+    validate_bool("8.8.8.8", "172.16.0.1", $my_ip)
+
+    The following values will fail, causing compilation to abort:
+
+    $some_array = [ 1, true, false, "garbage string", "3ffe:505:2" ]
+    validate_ipv4_address($some_array)
+
+    ENDHEREDOC
+  ) do |args|
+
+    require "ipaddr"
+    rescuable_exceptions = [ ArgumentError ]
+
+    if defined?(IPAddr::InvalidAddressError)
+      rescuable_exceptions << IPAddr::InvalidAddressError
+    end
+
+    unless args.length > 0 then
+      raise Puppet::ParseError, ("validate_ipv4_address(): wrong number of arguments (#{args.length}; must be > 0)")
+    end
+
+    args.each do |arg|
+      unless arg.is_a?(String)
+        raise Puppet::ParseError, "#{arg.inspect} is not a string."
+      end
+
+      begin
+        unless IPAddr.new(arg).ipv4?
+          raise Puppet::ParseError, "#{arg.inspect} is not a valid IPv4 address."
+        end
+      rescue *rescuable_exceptions
+        raise Puppet::ParseError, "#{arg.inspect} is not a valid IPv4 address."
+      end
+    end
+
+  end
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,49 @@
+module Puppet::Parser::Functions
+
+  newfunction(:validate_ipv6_address, :doc => <<-ENDHEREDOC
+    Validate that all values passed are valid IPv6 addresses.
+    Fail compilation if any value fails this check.
+
+    The following values will pass:
+
+    $my_ip = "3ffe:505:2"
+    validate_ipv6_address(1)
+    validate_ipv6_address($my_ip)
+    validate_bool("fe80::baf6:b1ff:fe19:7507", $my_ip)
+
+    The following values will fail, causing compilation to abort:
+
+    $some_array = [ true, false, "garbage string", "1.2.3.4" ]
+    validate_ipv6_address($some_array)
+
+    ENDHEREDOC
+  ) do |args|
+
+    require "ipaddr"
+    rescuable_exceptions = [ ArgumentError ]
+
+    if defined?(IPAddr::InvalidAddressError)
+      rescuable_exceptions << IPAddr::InvalidAddressError
+    end
+
+    unless args.length > 0 then
+      raise Puppet::ParseError, ("validate_ipv6_address(): wrong number of arguments (#{args.length}; must be > 0)")
+    end
+
+    args.each do |arg|
+      unless arg.is_a?(String)
+        raise Puppet::ParseError, "#{arg.inspect} is not a string."
+      end
+
+      begin
+        unless IPAddr.new(arg).ipv6?
+          raise Puppet::ParseError, "#{arg.inspect} is not a valid IPv6 address."
+        end
+      rescue *rescuable_exceptions
+        raise Puppet::ParseError, "#{arg.inspect} is not a valid IPv6 address."
+      end
+    end
+
+  end
+
+end
--- a/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -2,51 +2,70 @@
 
   newfunction(:validate_slength, :doc => <<-'ENDHEREDOC') do |args|
     Validate that the first argument is a string (or an array of strings), and
-    less/equal to than the length of the second argument.  It fails if the first
-    argument is not a string or array of strings, and if arg 2 is not convertable
-    to a number.
+    less/equal to than the length of the second argument. An optional third
+    parameter can be given a the minimum length. It fails if the first
+    argument is not a string or array of strings, and if arg 2 and arg 3 are
+    not convertable to a number.
 
     The following values will pass:
 
       validate_slength("discombobulate",17)
       validate_slength(["discombobulate","moo"],17)
+      validate_slength(["discombobulate","moo"],17,3)
 
     The following valueis will not:
 
       validate_slength("discombobulate",1)
       validate_slength(["discombobulate","thermometer"],5)
+      validate_slength(["discombobulate","moo"],17,10)
 
     ENDHEREDOC
 
-    raise Puppet::ParseError, ("validate_slength(): Wrong number of arguments (#{args.length}; must be = 2)") unless args.length == 2
+    raise Puppet::ParseError, "validate_slength(): Wrong number of arguments (#{args.length}; must be 2 or 3)" unless args.length == 2 or args.length == 3
+
+    input, max_length, min_length = *args
 
-    unless (args[0].is_a?(String) or args[0].is_a?(Array))
-      raise Puppet::ParseError, ("validate_slength(): please pass a string, or an array of strings - what you passed didn't work for me at all - #{args[0].class}")
+    begin
+      max_length = Integer(max_length)
+      raise ArgumentError if max_length <= 0
+    rescue ArgumentError, TypeError
+      raise Puppet::ParseError, "validate_slength(): Expected second argument to be a positive Numeric, got #{max_length}:#{max_length.class}"
     end
 
-    begin
-      max_length = args[1].to_i
-    rescue NoMethodError => e
-      raise Puppet::ParseError, ("validate_slength(): Couldn't convert whatever you passed as the length parameter to an integer  - sorry: " + e.message )
+    if min_length
+      begin
+        min_length = Integer(min_length)
+        raise ArgumentError if min_length < 0
+    rescue ArgumentError, TypeError
+        raise Puppet::ParseError, "validate_slength(): Expected third argument to be unset or a positive Numeric, got #{min_length}:#{min_length.class}"
+      end
+    else
+      min_length = 0
     end
 
-    raise Puppet::ParseError, ("validate_slength(): please pass a positive number as max_length") unless max_length > 0
+    if min_length > max_length
+      raise Puppet::ParseError, "validate_slength(): Expected second argument to be larger than third argument"
+    end
+
+    validator = lambda do |str|
+      unless str.length <= max_length and str.length >= min_length
+        raise Puppet::ParseError, "validate_slength(): Expected length of #{input.inspect} to be between #{min_length} and #{max_length}, was #{input.length}"
+      end
+    end
 
-    case args[0]
-      when String
-        raise Puppet::ParseError, ("validate_slength(): #{args[0].inspect} is #{args[0].length} characters.  It should have been less than or equal to #{max_length} characters") unless args[0].length <= max_length
-      when Array
-        args[0].each do |arg|
-          if arg.is_a?(String)
-            unless ( arg.is_a?(String) and arg.length <= max_length )
-              raise Puppet::ParseError, ("validate_slength(): #{arg.inspect} is #{arg.length} characters.  It should have been less than or equal to #{max_length} characters")
-            end
-          else
-            raise Puppet::ParseError, ("validate_slength(): #{arg.inspect} is not a string, it's a #{arg.class}")
-          end
+    case input
+    when String
+      validator.call(input)
+    when Array
+      input.each_with_index do |arg, pos|
+        if arg.is_a? String
+          validator.call(arg)
+        else
+          raise Puppet::ParseError, "validate_slength(): Expected element at array position #{pos} to be a String, got #{arg.class}"
         end
-      else
-        raise Puppet::ParseError, ("validate_slength(): please pass a string, or an array of strings - what you passed didn't work for me at all - #{args[0].class}")
+      end
+    else
+      raise Puppet::ParseError, "validate_slength(): Expected first argument to be a String or Array, got #{input.class}"
     end
   end
 end
--- a/modules/stdlib/lib/puppet/parser/functions/validate_string.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/validate_string.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -13,9 +13,14 @@
 
         validate_string(true)
         validate_string([ 'some', 'array' ])
-        $undefined = undef
-        validate_string($undefined)
-
+        
+    Note: validate_string(undef) will not fail in this version of the
+    functions API (incl. current and future parser). Instead, use:
+    
+        if $var == undef {
+          fail('...')
+        }
+    
     ENDHEREDOC
 
     unless args.length > 0 then
--- a/modules/stdlib/lib/puppet/parser/functions/values_at.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/values_at.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -49,6 +49,7 @@
     indices_list = []
 
     indices.each do |i|
+      i = i.to_s
       if m = i.match(/^(\d+)(\.\.\.?|\-)(\d+)$/)
         start = m[1].to_i
         stop  = m[3].to_i
--- a/modules/stdlib/lib/puppet/parser/functions/zip.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/zip.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -27,33 +27,7 @@
       raise(Puppet::ParseError, 'zip(): Requires array to work with')
     end
 
-    flatten = arguments[2] if arguments[2]
-
-    if flatten
-      klass = flatten.class
-
-      # We can have either true or false, or string which resembles boolean ...
-      unless [FalseClass, TrueClass, String].include?(klass)
-        raise(Puppet::ParseError, 'zip(): Requires either ' +
-          'boolean or string to work with')
-      end
-
-      if flatten.is_a?(String)
-        # We consider all the yes, no, y, n and so on too ...
-        flatten = case flatten
-          #
-          # This is how undef looks like in Puppet ...
-          # We yield false in this case.
-          #
-          when /^$/, '' then false # Empty string will be false ...
-          when /^(1|t|y|true|yes)$/  then true
-          when /^(0|f|n|false|no)$/  then false
-          when /^(undef|undefined)$/ then false # This is not likely to happen ...
-          else
-            raise(Puppet::ParseError, 'zip(): Unknown type of boolean given')
-        end
-      end
-    end
+    flatten = function_str2bool([arguments[2]]) if arguments[2]
 
     result = a.zip(b)
     result = flatten ? result.flatten : result
--- a/modules/stdlib/lib/puppet/provider/file_line/ruby.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/provider/file_line/ruby.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,6 +1,4 @@
-
 Puppet::Type.type(:file_line).provide(:ruby) do
-
   def exists?
     lines.find do |line|
       line.chomp == resource[:line].chomp
@@ -9,9 +7,11 @@
 
   def create
     if resource[:match]
-      handle_create_with_match()
+      handle_create_with_match
+    elsif resource[:after]
+      handle_create_with_after
     else
-      handle_create_without_match()
+      append_line
     end
   end
 
@@ -34,9 +34,9 @@
 
   def handle_create_with_match()
     regex = resource[:match] ? Regexp.new(resource[:match]) : nil
-    match_count = lines.select { |l| regex.match(l) }.size
-    if match_count > 1
-      raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'"
+    match_count = count_matches(regex)
+    if match_count > 1 && resource[:multiple].to_s != 'true'
+     raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'"
     end
     File.open(resource[:path], 'w') do |fh|
       lines.each do |l|
@@ -49,11 +49,37 @@
     end
   end
 
-  def handle_create_without_match
+  def handle_create_with_after
+    regex = Regexp.new(resource[:after])
+    count = count_matches(regex)
+    case count
+    when 1 # find the line to put our line after
+      File.open(resource[:path], 'w') do |fh|
+        lines.each do |l|
+          fh.puts(l)
+          if regex.match(l) then
+            fh.puts(resource[:line])
+          end
+        end
+      end
+    when 0 # append the line to the end of the file
+      append_line
+    else
+      raise Puppet::Error, "#{count} lines match pattern '#{resource[:after]}' in file '#{resource[:path]}'.  One or no line must match the pattern."
+    end
+  end
+
+  def count_matches(regex)
+    lines.select{|l| l.match(regex)}.size
+  end
+
+  ##
+  # append the line to the file.
+  #
+  # @api private
+  def append_line
     File.open(resource[:path], 'a') do |fh|
       fh.puts resource[:line]
     end
   end
-
-
 end
--- a/modules/stdlib/lib/puppet/type/file_line.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/lib/puppet/type/file_line.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -21,6 +21,9 @@
     In this example, Puppet will ensure both of the specified lines are
     contained in the file /etc/sudoers.
 
+    **Autorequires:** If Puppet is managing the file that will contain the line
+    being managed, the file_line resource will autorequire that file.
+
   EOT
 
   ensurable do
@@ -37,6 +40,15 @@
         'if a match is found, we replace that line rather than adding a new line.'
   end
 
+  newparam(:multiple) do
+    desc 'An optional value to determine if match can change multiple lines.'
+    newvalues(true, false)
+  end
+
+  newparam(:after) do
+    desc 'An optional value used to specify the line after which we will add any new lines. (Existing lines are added in place)'
+  end
+
   newparam(:line) do
     desc 'The line to be appended to the file located by the path parameter.'
   end
@@ -59,12 +71,5 @@
     unless self[:line] and self[:path]
       raise(Puppet::Error, "Both line and path are required attributes")
     end
-
-    if (self[:match])
-      unless Regexp.new(self[:match]).match(self[:line])
-        raise(Puppet::Error, "When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter")
-      end
-    end
-
   end
 end
--- a/modules/stdlib/metadata.json	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/metadata.json	Sat Mar 14 20:09:45 2015 +0000
@@ -1,270 +1,113 @@
 {
-  "types": [
+  "name": "puppetlabs-stdlib",
+  "version": "4.5.1",
+  "author": "puppetlabs",
+  "summary": "Standard library of resources for Puppet modules.",
+  "license": "Apache-2.0",
+  "source": "https://github.com/puppetlabs/puppetlabs-stdlib",
+  "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
+  "issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
+  "operatingsystem_support": [
+    {
+      "operatingsystem": "RedHat",
+      "operatingsystemrelease": [
+        "4",
+        "5",
+        "6",
+        "7"
+      ]
+    },
     {
-      "doc": "  A simple resource type intended to be used as an anchor in a composite class.\n\n  In Puppet 2.6, when a class declares another class, the resources in the\n  interior class are not contained by the exterior class. This interacts badly\n  with the pattern of composing complex modules from smaller classes, as it\n  makes it impossible for end users to specify order relationships between the\n  exterior class and other modules.\n\n  The anchor type lets you work around this. By sandwiching any interior\n  classes between two no-op resources that _are_ contained by the exterior\n  class, you can ensure that all resources in the module are contained.\n\n      class ntp {\n        # These classes will have the correct order relationship with each\n        # other. However, without anchors, they won't have any order\n        # relationship to Class['ntp'].\n        class { 'ntp::package': }\n        -> class { 'ntp::config': }\n        -> class { 'ntp::service': }\n\n        # These two resources \"anchor\" the composed classes within the ntp\n        # class.\n        anchor { 'ntp::begin': } -> Class['ntp::package']\n        Class['ntp::service']    -> anchor { 'ntp::end': }\n      }\n\n  This allows the end user of the ntp module to establish require and before\n  relationships with Class['ntp']:\n\n      class { 'ntp': } -> class { 'mcollective': }\n      class { 'mcollective': } -> class { 'ntp': }\n\n",
-      "parameters": [
-        {
-          "doc": "The name of the anchor resource.",
-          "name": "name"
-        }
-      ],
-      "name": "anchor",
-      "properties": [
-
+      "operatingsystem": "CentOS",
+      "operatingsystemrelease": [
+        "4",
+        "5",
+        "6",
+        "7"
+      ]
+    },
+    {
+      "operatingsystem": "OracleLinux",
+      "operatingsystemrelease": [
+        "4",
+        "5",
+        "6",
+        "7"
+      ]
+    },
+    {
+      "operatingsystem": "Scientific",
+      "operatingsystemrelease": [
+        "4",
+        "5",
+        "6",
+        "7"
       ]
     },
     {
-      "doc": "    Ensures that a given line is contained within a file.  The implementation\n    matches the full line, including whitespace at the beginning and end.  If\n    the line is not contained in the given file, Puppet will add the line to\n    ensure the desired state.  Multiple resources may be declared to manage\n    multiple lines in the same file.\n\n    Example:\n\n        file_line { 'sudo_rule':\n          path => '/etc/sudoers',\n          line => '%sudo ALL=(ALL) ALL',\n        }\n        file_line { 'sudo_rule_nopw':\n          path => '/etc/sudoers',\n          line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',\n        }\n\n    In this example, Puppet will ensure both of the specified lines are\n    contained in the file /etc/sudoers.\n\n",
-      "providers": [
-        {
-          "doc": "",
-          "name": "ruby"
-        }
-      ],
-      "parameters": [
-        {
-          "doc": "An arbitrary name used as the identity of the resource.",
-          "name": "name"
-        },
-        {
-          "doc": "An optional regular expression to run against existing lines in the file;\\nif a match is found, we replace that line rather than adding a new line.",
-          "name": "match"
-        },
-        {
-          "doc": "The line to be appended to the file located by the path parameter.",
-          "name": "line"
-        },
-        {
-          "doc": "The file Puppet will ensure contains the line specified by the line parameter.",
-          "name": "path"
-        }
-      ],
-      "name": "file_line",
-      "properties": [
-        {
-          "doc": "The basic property that the resource should be in.  Valid values are `present`, `absent`.",
-          "name": "ensure"
-        }
+      "operatingsystem": "SLES",
+      "operatingsystemrelease": [
+        "10 SP4",
+        "11 SP1",
+        "12"
+      ]
+    },
+    {
+      "operatingsystem": "Debian",
+      "operatingsystemrelease": [
+        "6",
+        "7"
+      ]
+    },
+    {
+      "operatingsystem": "Ubuntu",
+      "operatingsystemrelease": [
+        "10.04",
+        "12.04",
+        "14.04"
+      ]
+    },
+    {
+      "operatingsystem": "Solaris",
+      "operatingsystemrelease": [
+        "10",
+        "11"
+      ]
+    },
+    {
+      "operatingsystem": "Windows",
+      "operatingsystemrelease": [
+        "Server 2003",
+        "Server 2003 R2",
+        "Server 2008",
+        "Server 2008 R2",
+        "Server 2012",
+        "Server 2012 R2",
+        "7",
+        "8"
+      ]
+    },
+    {
+      "operatingsystem": "AIX",
+      "operatingsystemrelease": [
+        "5.3",
+        "6.1",
+        "7.1"
       ]
     }
   ],
-  "license": "Apache 2.0",
-  "checksums": {
-    "spec/unit/puppet/parser/functions/uriescape_spec.rb": "8d9e15156d93fe29bfe91a2e83352ff4",
-    "Gemfile": "a7144ac8fdb2255ed7badb6b54f6c342",
-    "spec/unit/facter/root_home_spec.rb": "4f4c4236ac2368d2e27fd2f3eb606a19",
-    "spec/unit/puppet/parser/functions/size_spec.rb": "d126b696b21a8cd754d58f78ddba6f06",
-    "spec/unit/puppet/parser/functions/shuffle_spec.rb": "2141a54d2fb3cf725b88184d639677f4",
-    "spec/unit/puppet/parser/functions/validate_re_spec.rb": "b21292ad2f30c0d43ab2f0c2df0ba7d5",
-    "lib/puppet/parser/functions/flatten.rb": "25777b76f9719162a8bab640e5595b7a",
-    "lib/puppet/parser/functions/ensure_packages.rb": "ca852b2441ca44b91a984094de4e3afc",
-    "lib/puppet/parser/functions/validate_augeas.rb": "d4acca7b8a9fdada9ae39e5101902cc1",
-    "spec/unit/puppet/parser/functions/unique_spec.rb": "2df8b3b2edb9503943cb4dcb4a371867",
-    "tests/has_ip_network.pp": "abc05686797a776ea8c054657e6f7456",
-    "spec/fixtures/manifests/site.pp": "d41d8cd98f00b204e9800998ecf8427e",
-    "lib/puppet/parser/functions/defined_with_params.rb": "ffab4433d03f32b551f2ea024a2948fc",
-    "lib/puppet/parser/functions/size.rb": "8972d48c0f9e487d659bd7326b40b642",
-    "lib/puppet/parser/functions/has_ip_address.rb": "ee207f47906455a5aa49c4fb219dd325",
-    "lib/facter/util/puppet_settings.rb": "9f1d2593d0ae56bfca89d4b9266aeee1",
-    "spec/unit/puppet/parser/functions/any2array_spec.rb": "167e114cfa222de971bf8be141766b6a",
-    "spec/unit/facter/pe_required_facts_spec.rb": "0ec83db2a004a0d7f6395b34939c53b9",
-    "spec/unit/puppet/parser/functions/bool2num_spec.rb": "67c3055d5d4e4c9fbcaca82038a09081",
-    "lib/facter/root_home.rb": "f559294cceafcf70799339627d94871d",
-    "lib/puppet/parser/functions/loadyaml.rb": "2b912f257aa078e376d3b3f6a86c2a00",
-    "spec/unit/puppet/parser/functions/is_float_spec.rb": "171fc0e382d9856c2d8db2b70c9ec9cd",
-    "lib/puppet/type/anchor.rb": "bbd36bb49c3b554f8602d8d3df366c0c",
-    "lib/puppet/parser/functions/getparam.rb": "4dd7a0e35f4a3780dcfc9b19b4e0006e",
-    "lib/facter/facter_dot_d.rb": "b35b8b59ec579901444f984127f0b833",
-    "lib/puppet/parser/functions/strftime.rb": "e02e01a598ca5d7d6eee0ba22440304a",
-    "lib/puppet/parser/functions/max.rb": "f652fd0b46ef7d2fbdb42b141f8fdd1d",
-    "spec/spec_helper.rb": "4449b0cafd8f7b2fb440c0cdb0a1f2b3",
-    "lib/puppet/parser/functions/merge.rb": "52281fe881b762e2adfef20f58dc4180",
-    "lib/puppet/parser/functions/validate_slength.rb": "0ca530d1d3b45c3fe2d604c69acfc22f",
-    "spec/unit/puppet/parser/functions/suffix_spec.rb": "c3eed8e40066f2ad56264405c4192f2e",
-    "spec/unit/puppet/parser/functions/validate_bool_spec.rb": "32a580f280ba62bf17ccd30460d357bd",
-    "spec/unit/puppet/parser/functions/str2bool_spec.rb": "60e3eaea48b0f6efccc97010df7d912c",
-    "lib/puppet/parser/functions/reject.rb": "689f6a7c961a55fe9dcd240921f4c7f9",
-    "lib/puppet/parser/functions/delete.rb": "9b17b9f7f820adf02360147c1a2f4279",
-    "lib/puppet/parser/functions/strip.rb": "273d547c7b05c0598556464dfd12f5fd",
-    "lib/puppet/parser/functions/values.rb": "066a6e4170e5034edb9a80463dff2bb5",
-    "LICENSE": "38a048b9d82e713d4e1b2573e370a756",
-    "lib/puppet/parser/functions/is_array.rb": "875ca4356cb0d7a10606fb146b4a3d11",
-    "spec/unit/puppet/parser/functions/strip_spec.rb": "a01796bebbdabd3fad12b0662ea5966e",
-    "lib/puppet/parser/functions/swapcase.rb": "4902f38f0b9292afec66d40fee4b02ec",
-    "lib/puppet/parser/functions/has_ip_network.rb": "b4d726c8b2a0afac81ced8a3a28aa731",
-    "spec/unit/puppet/parser/functions/validate_array_spec.rb": "bcd231229554785c4270ca92ef99cb60",
-    "lib/puppet/parser/functions/validate_re.rb": "c6664b3943bc820415a43f16372dc2a9",
-    "lib/puppet/parser/functions/time.rb": "08d88d52abd1e230e3a2f82107545d48",
-    "lib/puppet/parser/functions/is_numeric.rb": "0a9bcc49e8f57af81bdfbb7e7c3a575c",
-    "spec/unit/puppet/parser/functions/merge_spec.rb": "a63c0bc2f812e27fbef570d834ef61ce",
-    "lib/puppet/parser/functions/count.rb": "9eb74eccd93e2b3c87fd5ea14e329eba",
-    "spec/unit/puppet/parser/functions/values_at_spec.rb": "de45fd8abbc4c037c3c4fac2dcf186f9",
-    "spec/monkey_patches/publicize_methods.rb": "ce2c98f38b683138c5ac649344a39276",
-    "spec/unit/puppet/parser/functions/is_hash_spec.rb": "408e121a5e30c4c5c4a0a383beb6e209",
-    "lib/puppet/parser/functions/chop.rb": "4691a56e6064b792ed4575e4ad3f3d20",
-    "spec/unit/puppet/parser/functions/validate_cmd_spec.rb": "538db08292a0ecc4cd902a14aaa55d74",
-    "spec/unit/puppet/parser/functions/is_integer_spec.rb": "a302cf1de5ccb494ca9614d2fc2b53c5",
-    "spec/functions/ensure_resource_spec.rb": "3423a445e13efc7663a71c6641d49d07",
-    "spec/unit/puppet/parser/functions/keys_spec.rb": "35cc2ed490dc68da6464f245dfebd617",
-    "manifests/init.pp": "f2ba5f36e7227ed87bbb69034fc0de8b",
-    "lib/puppet/parser/functions/dirname.rb": "bef7214eb89db3eb8f7ee5fc9dca0233",
-    "lib/puppet/parser/functions/validate_hash.rb": "e9cfaca68751524efe16ecf2f958a9a0",
-    "lib/puppet/parser/functions/join_keys_to_values.rb": "f29da49531228f6ca5b3aa0df00a14c2",
-    "spec/unit/puppet/parser/functions/delete_spec.rb": "0d84186ea618523b4b2a4ca0b5a09c9e",
-    "lib/puppet/parser/functions/validate_string.rb": "6afcbc51f83f0714348b8d61e06ea7eb",
-    "spec/unit/puppet/parser/functions/rstrip_spec.rb": "a408e933753c9c323a05d7079d32cbb3",
-    "spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb": "c67b71737bee9936f5261d41a37bad46",
-    "spec/unit/puppet/parser/functions/concat_spec.rb": "c21aaa84609f92290d5ffb2ce8ea4bf5",
-    "lib/puppet/parser/functions/unique.rb": "217ccce6d23235af92923f50f8556963",
-    "CHANGELOG": "344383410cb78409f0c59ecf38e8c21a",
-    "lib/puppet/parser/functions/member.rb": "541e67d06bc4155e79b00843a125e9bc",
-    "spec/unit/puppet/parser/functions/validate_string_spec.rb": "64a4f681084cba55775a070f7fab5e0c",
-    "lib/facter/puppet_vardir.rb": "c7ddc97e8a84ded3dd93baa5b9b3283d",
-    "lib/puppet/parser/functions/pick.rb": "2bede116a0651405c47e650bbf942abe",
-    "spec/unit/puppet/parser/functions/parseyaml_spec.rb": "65dfed872930ffe0d21954c15daaf498",
-    "lib/puppet/parser/functions/delete_at.rb": "6bc24b79390d463d8be95396c963381a",
-    "lib/puppet/parser/functions/zip.rb": "a80782461ed9465f0cd0c010936f1855",
-    "tests/file_line.pp": "67727539aa7b7dd76f06626fe734f7f7",
-    "lib/puppet/parser/functions/ensure_resource.rb": "3f68b8e17a16bfd01455cd73f8e324ba",
-    "lib/puppet/parser/functions/num2bool.rb": "605c12fa518c87ed2c66ae153e0686ce",
-    "spec/unit/puppet/parser/functions/grep_spec.rb": "78179537496a7150469e591a95e255d8",
-    "lib/puppet/parser/functions/keys.rb": "eb6ac815ea14fbf423580ed903ef7bad",
-    "spec/unit/puppet/parser/functions/num2bool_spec.rb": "8cd5b46b7c8e612dfae3362e3a68a5f9",
-    "lib/puppet/parser/functions/parsejson.rb": "e7f968c34928107b84cd0860daf50ab1",
-    "lib/puppet/parser/functions/is_mac_address.rb": "288bd4b38d4df42a83681f13e7eaaee0",
-    "lib/puppet/parser/functions/join.rb": "b28087823456ca5cf943de4a233ac77f",
-    "spec/unit/puppet/parser/functions/type_spec.rb": "422f2c33458fe9b0cc9614d16f7573ba",
-    "lib/puppet/parser/functions/downcase.rb": "9204a04c2a168375a38d502db8811bbe",
-    "spec/unit/puppet/parser/functions/validate_augeas_spec.rb": "1d5bcfbf97dc56b45734248a14358d4f",
-    "spec/unit/puppet/parser/functions/has_ip_address_spec.rb": "f53c7baeaf024ff577447f6c28c0f3a7",
-    "lib/puppet/parser/functions/is_function_available.rb": "88c63869cb5df3402bc9756a8d40c16d",
-    "lib/puppet/parser/functions/prefix.rb": "21fd6a2c1ee8370964346b3bfe829d2b",
-    "spec/watchr.rb": "b588ddf9ef1c19ab97aa892cc776da73",
-    "spec/unit/puppet/parser/functions/has_key_spec.rb": "3e4e730d98bbdfb88438b6e08e45868e",
-    "lib/puppet/parser/functions/values_at.rb": "094ac110ce9f7a5b16d0c80a0cf2243c",
-    "lib/puppet/parser/functions/fqdn_rotate.rb": "20743a138c56fc806a35cb7b60137dbc",
-    "lib/puppet/parser/functions/rstrip.rb": "8a0d69876bdbc88a2054ba41c9c38961",
-    "spec/unit/puppet/parser/functions/validate_slength_spec.rb": "a1b4d805149dc0143e9a57e43e1f84bf",
-    "spec/functions/ensure_packages_spec.rb": "935b4aec5ab36bdd0458c1a9b2a93ad5",
-    "lib/puppet/parser/functions/suffix.rb": "109279db4180441e75545dbd5f273298",
-    "lib/puppet/parser/functions/str2saltedsha512.rb": "49afad7b386be38ce53deaefef326e85",
-    "spec/unit/puppet/parser/functions/count_spec.rb": "db98ef89752a7112425f0aade10108e0",
-    "lib/puppet/parser/functions/hash.rb": "9d072527dfc7354b69292e9302906530",
-    "manifests/stages.pp": "cc6ed1751d334b0ea278c0335c7f0b5a",
-    "spec/unit/puppet/parser/functions/is_ip_address_spec.rb": "6040a9bae4e5c853966148b634501157",
-    "spec/unit/facter/pe_version_spec.rb": "ef031cca838f36f99b1dab3259df96a5",
-    "spec/unit/puppet/parser/functions/get_module_path_spec.rb": "b7ea196f548b1a9a745ab6671295ab27",
-    "lib/puppet/parser/functions/is_integer.rb": "a50ebc15c30bffd759e4a6f8ec6a0cf3",
-    "lib/puppet/parser/functions/reverse.rb": "1386371c0f5301055fdf99079e862b3e",
-    "spec/unit/puppet/parser/functions/has_interface_with_spec.rb": "7c16d731c518b434c81b8cb2227cc916",
-    "README_SPECS.markdown": "82bb4c6abbb711f40778b162ec0070c1",
-    "spec/unit/puppet/parser/functions/is_domain_name_spec.rb": "8eed3a9eb9334bf6a473ad4e2cabc2ec",
-    "spec/unit/puppet/parser/functions/join_spec.rb": "c3b50c39390a86b493511be2c6722235",
-    "lib/puppet/parser/functions/chomp.rb": "719d46923d75251f7b6b68b6e015cccc",
-    "lib/puppet/parser/functions/is_string.rb": "2bd9a652bbb2668323eee6c57729ff64",
-    "spec/unit/puppet/parser/functions/is_array_spec.rb": "8c020af9c360abdbbf1ba887bb26babe",
-    "Modulefile": "351bba73290cd526ca7bacd4c7d250dc",
-    "spec/unit/puppet/parser/functions/reject_spec.rb": "8e16c9f064870e958b6278261e480954",
-    "spec/unit/puppet/type/file_line_spec.rb": "d9f4e08e8b98e565a07f1b995593fa89",
-    "spec/unit/puppet/parser/functions/lstrip_spec.rb": "1fc2c2d80b5f724a358c3cfeeaae6249",
-    "lib/puppet/parser/functions/type.rb": "62f914d6c90662aaae40c5539701be60",
-    "lib/puppet/parser/functions/shuffle.rb": "6445e6b4dc62c37b184a60eeaf34414b",
-    "lib/puppet/parser/functions/has_key.rb": "7cd9728c38f0b0065f832dabd62b0e7e",
-    "lib/puppet/parser/functions/concat.rb": "f28a09811ff4d19bb5e7a540e767d65c",
-    "spec/unit/puppet/parser/functions/capitalize_spec.rb": "82a4209a033fc88c624f708c12e64e2a",
-    "tests/init.pp": "1d98070412c76824e66db4b7eb74d433",
-    "lib/puppet/provider/file_line/ruby.rb": "a445a57f9b884037320ea37307dbc92b",
-    "tests/has_ip_address.pp": "93ce02915f67ddfb43a049b2b84ef391",
-    "spec/unit/puppet/parser/functions/min_spec.rb": "bf80bf58261117bb24392670b624a611",
-    "lib/puppet/parser/functions/to_bytes.rb": "83f23c33adbfa42b2a9d9fc2db3daeb4",
-    "lib/puppet/parser/functions/sort.rb": "504b033b438461ca4f9764feeb017833",
-    "lib/puppet/parser/functions/capitalize.rb": "14481fc8c7c83fe002066ebcf6722f17",
-    "lib/puppet/type/file_line.rb": "3e8222cb58f3503b3ea7de3647c602a0",
-    "lib/puppet/parser/functions/has_interface_with.rb": "8d3ebca805dc6edb88b6b7a13d404787",
-    "spec/functions/getparam_spec.rb": "122f37cf9ec7489f1dae10db39c871b5",
-    "Rakefile": "f37e6131fe7de9a49b09d31596f5fbf1",
-    "spec/unit/puppet/parser/functions/downcase_spec.rb": "b0197829512f2e92a2d2b06ce8e2226f",
-    "spec/unit/puppet/parser/functions/max_spec.rb": "5562bccc643443af7e4fa7c9d1e52b8b",
-    "lib/puppet/parser/functions/validate_absolute_path.rb": "385137ac24a2dec6cecc4e6ea75be442",
-    "spec/unit/puppet/parser/functions/getvar_spec.rb": "842bf88d47077a9ae64097b6e39c3364",
-    "spec/unit/puppet/parser/functions/sort_spec.rb": "7039cd230a94e95d9d1de2e1094acae2",
-    "spec/unit/puppet/parser/functions/strftime_spec.rb": "bf140883ecf3254277306fa5b25f0344",
-    "spec/unit/puppet/parser/functions/is_mac_address_spec.rb": "644cd498b426ff2f9ea9cbc5d8e141d7",
-    "spec/unit/puppet/parser/functions/empty_spec.rb": "028c30267d648a172d8a81a9262c3abe",
-    "lib/puppet/parser/functions/is_domain_name.rb": "fba9f855df3bbf90d72dfd5201f65d2b",
-    "lib/puppet/parser/functions/get_module_path.rb": "d4bf50da25c0b98d26b75354fa1bcc45",
-    "spec/unit/puppet/provider/file_line/ruby_spec.rb": "e8cd7432739cb212d40a9148523bd4d7",
-    "spec/unit/puppet/parser/functions/reverse_spec.rb": "48169990e59081ccbd112b6703418ce4",
-    "spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb": "1de174be8835ba6fef86b590887bb2cc",
-    "spec/unit/puppet/parser/functions/prefix_spec.rb": "16a95b321d76e773812693c80edfbe36",
-    "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
-    "spec/monkey_patches/alias_should_to_must.rb": "7cd4065c63f06f1ab3aaa1c5f92af947",
-    "lib/puppet/parser/functions/uriescape.rb": "9ebc34f1b2f319626512b8cd7cde604c",
-    "lib/puppet/parser/functions/floor.rb": "c5a960e9714810ebb99198ff81a11a3b",
-    "lib/puppet/parser/functions/empty.rb": "ae92905c9d94ddca30bf56b7b1dabedf",
-    "spec/unit/puppet/parser/functions/range_spec.rb": "91d69115dea43f62a2dca9a10467d836",
-    "tests/has_interface_with.pp": "59c98b4af0d39fc11d1ef4c7a6dc8f7a",
-    "spec/unit/puppet/parser/functions/is_function_available.rb": "069ef7490eba66424cab75444f36828a",
-    "README_DEVELOPER.markdown": "220a8b28521b5c5d2ea87c4ddb511165",
-    "spec/unit/puppet/parser/functions/flatten_spec.rb": "583c9a70f93e492cfb22ffa1811f6aa0",
-    "lib/puppet/parser/functions/upcase.rb": "a5744a74577cfa136fca2835e75888d3",
-    "lib/puppet/parser/functions/str2bool.rb": "c822a8944747f5624b13f2da0df8db21",
-    "lib/puppet/parser/functions/is_hash.rb": "8c7d9a05084dab0389d1b779c8a05b1a",
-    "lib/puppet/parser/functions/abs.rb": "32161bd0435fdfc2aec2fc559d2b454b",
-    "spec/unit/puppet/parser/functions/validate_hash_spec.rb": "8529c74051ceb71e6b1b97c9cecdf625",
-    "spec/unit/puppet/parser/functions/member_spec.rb": "067c60985efc57022ca1c5508d74d77f",
-    "README.markdown": "b63097a958f22abf7999d475a6a4d32a",
-    "spec/unit/puppet/parser/functions/values_spec.rb": "0ac9e141ed1f612d7cc224f747b2d1d9",
-    "lib/puppet/parser/functions/validate_cmd.rb": "0319a15d24fd077ebabc2f79969f6ab5",
-    "lib/puppet/parser/functions/is_float.rb": "f1b0d333061d31bf0c25bd4c33dc134b",
-    "lib/puppet/parser/functions/bool2num.rb": "8e627eee990e811e35e7e838c586bd77",
-    "lib/puppet/parser/functions/validate_bool.rb": "4ddffdf5954b15863d18f392950b88f4",
-    "lib/puppet/parser/functions/grep.rb": "5682995af458b05f3b53dd794c4bf896",
-    "spec/unit/puppet/parser/functions/upcase_spec.rb": "813668919bc62cdd1d349dafc19fbbb3",
-    "spec/unit/puppet/parser/functions/parsejson_spec.rb": "37ab84381e035c31d6a3dd9bf73a3d53",
-    "spec/unit/puppet/parser/functions/squeeze_spec.rb": "df5b349c208a9a2a4d4b8e6d9324756f",
-    "spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb": "07839082d24d5a7628fd5bce6c8b35c3",
-    "spec/unit/puppet/parser/functions/chop_spec.rb": "4e9534d25b952b261c9f46add677c390",
-    "lib/puppet/parser/functions/squeeze.rb": "541f85b4203b55c9931d3d6ecd5c75f8",
-    "lib/puppet/parser/functions/lstrip.rb": "210b103f78622e099f91cc2956b6f741",
-    "spec/unit/puppet/type/anchor_spec.rb": "a5478a72a7fab2d215f39982a9230c18",
-    "lib/facter/pe_version.rb": "4a9353952963b011759f3e6652a10da5",
-    "spec/unit/puppet/parser/functions/hash_spec.rb": "826337a92d8f7a189b7ac19615db0ed7",
-    "spec/unit/puppet/parser/functions/floor_spec.rb": "d01ef7dfe0245d7a0a73d7df13cb02e3",
-    "spec/unit/puppet/parser/functions/time_spec.rb": "b6d0279062779efe5153fe5cfafc5bbd",
-    "spec/unit/puppet/parser/functions/swapcase_spec.rb": "0660ce8807608cc8f98ad1edfa76a402",
-    "lib/puppet/parser/functions/validate_array.rb": "72b29289b8af1cfc3662ef9be78911b8",
-    "lib/puppet/parser/functions/is_ip_address.rb": "a714a736c1560e8739aaacd9030cca00",
-    "lib/puppet/parser/functions/getvar.rb": "10bf744212947bc6a7bfd2c9836dbd23",
-    "RELEASE_PROCESS.markdown": "94b92bc99ac4106ba1a74d5c04e520f9",
-    "spec/classes/anchor_spec.rb": "695d65275c3ac310d7fa23b91f8bbb4a",
-    "lib/puppet/parser/functions/any2array.rb": "a81e71d6b67a551d38770ba9a1948a75",
-    "spec/functions/defined_with_params_spec.rb": "3bdfac38e3d6f06140ff2e926f4ebed2",
-    "spec/unit/puppet/parser/functions/pick_spec.rb": "aba6247d3925e373272fca6768fd5403",
-    "spec/unit/puppet/parser/functions/to_bytes_spec.rb": "80aaf68cf7e938e46b5278c1907af6be",
-    "spec/unit/puppet/parser/functions/is_string_spec.rb": "5c015d8267de852da3a12b984e077092",
-    "spec/unit/puppet/parser/functions/abs_spec.rb": "0a5864a29a8e9e99acc483268bd5917c",
-    "spec/unit/facter/util/puppet_settings_spec.rb": "345bcbef720458e25be0190b7638e4d9",
-    "spec/unit/puppet/parser/functions/zip_spec.rb": "06a86e4e70d2aea63812582aae1d26c4",
-    "spec/unit/puppet/parser/functions/dirname_spec.rb": "1d7cf70468c2cfa6dacfc75935322395",
-    "spec/unit/puppet/parser/functions/delete_at_spec.rb": "5a4287356b5bd36a6e4c100421215b8e",
-    "spec/unit/puppet/parser/functions/chomp_spec.rb": "3cd8e2fe6b12efeffad94cce5b693b7c",
-    "spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb": "7c7937411b7fe4bb944c0c022d3a96b0",
-    "lib/puppet/parser/functions/range.rb": "033048bba333fe429e77e0f2e91db25f",
-    "lib/puppet/parser/functions/parseyaml.rb": "00f10ec1e2b050e23d80c256061ebdd7",
-    "spec/unit/puppet/parser/functions/is_numeric_spec.rb": "5f08148803b6088c27b211c446ad3658",
-    "spec/unit/puppet/parser/functions/has_ip_network_spec.rb": "885ea8a4c987b735d683b742bf846cb1",
-    "lib/puppet/parser/functions/min.rb": "0d2a1b7e735ab251c5469e735fa3f4c6",
-    "CONTRIBUTING.md": "fdddc4606dc3b6949e981e6bf50bc8e5"
-  },
-  "version": "4.1.0",
+  "requirements": [
+    {
+      "name": "pe",
+      "version_requirement": "3.x"
+    },
+    {
+      "name": "puppet",
+      "version_requirement": ">=2.7.20 <4.0.0"
+    }
+  ],
   "description": "Standard Library for Puppet Modules",
-  "source": "git://github.com/puppetlabs/puppetlabs-stdlib.git",
-  "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
-  "summary": "Puppet Module Standard Library",
   "dependencies": [
-
-  ],
-  "author": "puppetlabs",
-  "name": "puppetlabs-stdlib"
-}
\ No newline at end of file
+  
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/abs_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,30 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should accept a string' do
+      pp = <<-EOS
+      $input  = '-34.56'
+      $output = abs($input)
+      notify { "$output": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 34.56/)
+      end
+    end
+
+    it 'should accept a float' do
+      pp = <<-EOS
+      $input  = -34.56
+      $output = abs($input)
+      notify { "$output": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 34.56/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/any2array_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,49 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should create an empty array' do
+      pp = <<-EOS
+      $input = ''
+      $output = any2array($input)
+      validate_array($output)
+      notify { "Output: ${output}": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: Output: /)
+      end
+    end
+
+    it 'should leave arrays modified' do
+      pp = <<-EOS
+      $input = ['test', 'array']
+      $output = any2array($input)
+      validate_array($output)
+      notify { "Output: ${output}": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
+      end
+    end
+
+    it 'should turn a hash into an array' do
+      pp = <<-EOS
+      $input = {'test' => 'array'}
+      $output = any2array($input)
+
+      validate_array($output)
+      # Check each element of the array is a plain string.
+      validate_string($output[0])
+      validate_string($output[1])
+      notify { "Output: ${output}": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/base64_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,18 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should encode then decode a string' do
+      pp = <<-EOS
+      $encodestring = base64('encode', 'thestring')
+      $decodestring = base64('decode', $encodestring)
+      notify { $decodestring: }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/thestring/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/bool2num_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    ['false', 'f', '0', 'n', 'no'].each do |bool|
+      it "should convert a given boolean, #{bool}, to 0" do
+        pp = <<-EOS
+        $input = "#{bool}"
+        $output = bool2num($input)
+        notify { "$output": }
+        EOS
+
+        apply_manifest(pp, :catch_failures => true) do |r|
+          expect(r.stdout).to match(/Notice: 0/)
+        end
+      end
+    end
+
+    ['true', 't', '1', 'y', 'yes'].each do |bool|
+      it "should convert a given boolean, #{bool}, to 1" do
+        pp = <<-EOS
+        $input = "#{bool}"
+        $output = bool2num($input)
+        notify { "$output": }
+        EOS
+
+        apply_manifest(pp, :catch_failures => true) do |r|
+          expect(r.stdout).to match(/Notice: 1/)
+        end
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/build_csv.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,83 @@
+#!/usr/bin/env ruby
+# vim: set sw=2 sts=2 et tw=80 :
+require 'rspec'
+
+#XXX Super ugly hack to keep from starting beaker nodes
+module Kernel
+  # make an alias of the original require
+  alias_method :original_require, :require
+  # rewrite require
+  def require name
+    original_require name if name != 'spec_helper_acceptance'
+  end
+end
+UNSUPPORTED_PLATFORMS = []
+def fact(*args) [] end
+#XXX End hax
+
+# Get a list of functions for test coverage
+function_list = Dir[File.join(File.dirname(__FILE__),"..","..","lib","puppet","parser","functions","*.rb")].collect do |function_rb|
+  File.basename(function_rb,".rb")
+end
+
+## Configure rspec to parse tests
+options = RSpec::Core::ConfigurationOptions.new(['spec/acceptance'])
+configuration = RSpec::configuration
+world = RSpec::world
+options.parse_options
+options.configure(configuration)
+configuration.load_spec_files
+
+## Collect up tests and example groups into a hash
+def get_tests(children)
+  children.inject({}) do |memo,c|
+    memo[c.description] = Hash.new
+    memo[c.description]["groups"] = get_tests(c.children) unless c.children.empty?
+    memo[c.description]["tests"] = c.examples.collect { |e|
+      e.description unless e.pending?
+    }.compact unless c.examples.empty?
+    memo[c.description]["pending_tests"] = c.examples.collect { |e|
+      e.description if e.pending?
+    }.compact unless c.examples.empty?
+    memo
+  end
+end
+
+def count_test_types_in(type,group)
+  return 0 if group.nil?
+  group.inject(0) do |m,(k,v)|
+    m += v.length if k == type
+    m += count_tests_in(v) if v.is_a?(Hash)
+    m
+  end
+end
+def count_tests_in(group)
+  count_test_types_in('tests',group)
+end
+def count_pending_tests_in(group)
+  count_test_types_in('pending_tests',group)
+end
+
+# Convert tests hash to csv format
+def to_csv(function_list,tests)
+  function_list.collect do |function_name|
+    if v = tests["#{function_name} function"]
+      positive_tests = count_tests_in(v["groups"]["success"])
+      negative_tests = count_tests_in(v["groups"]["failure"])
+      pending_tests  =
+        count_pending_tests_in(v["groups"]["failure"]) +
+        count_pending_tests_in(v["groups"]["failure"])
+    else
+      positive_tests = 0
+      negative_tests = 0
+      pending_tests  = 0
+    end
+    sprintf("%-25s, %-9d, %-9d, %-9d", function_name,positive_tests,negative_tests,pending_tests)
+  end.compact
+end
+
+tests = get_tests(world.example_groups)
+csv = to_csv(function_list,tests)
+percentage_tested = "#{tests.count*100/function_list.count}%"
+printf("%-25s,  %-9s, %-9s, %-9s\n","#{percentage_tested} have tests.","Positive","Negative","Pending")
+puts csv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/capitalize_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'capitalize function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should capitalize the first letter of a string' do
+      pp = <<-EOS
+      $input = 'this is a string'
+      $output = capitalize($input)
+      notify { $output: }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: This is a string/)
+      end
+    end
+
+    it 'should capitalize the first letter of an array of strings' do
+      pp = <<-EOS
+      $input = ['this', 'is', 'a', 'string']
+      $output = capitalize($input)
+      notify { $output: }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: This/)
+        expect(r.stdout).to match(/Notice: Is/)
+        expect(r.stdout).to match(/Notice: A/)
+        expect(r.stdout).to match(/Notice: String/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/chomp_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,21 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should eat the newline' do
+      pp = <<-EOS
+      $input = "test\n"
+      if size($input) != 5 {
+        fail("Size of ${input} is not 5.")
+      }
+      $output = chomp($input)
+      if size($output) != 4 {
+        fail("Size of ${input} is not 4.")
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/chop_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,45 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should eat the last character' do
+      pp = <<-EOS
+      $input = "test"
+      if size($input) != 4 {
+        fail("Size of ${input} is not 4.")
+      }
+      $output = chop($input)
+      if size($output) != 3 {
+        fail("Size of ${input} is not 3.")
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+
+    it 'should eat the last two characters of \r\n' do
+      pp = <<-'EOS'
+      $input = "test\r\n"
+      if size($input) != 6 {
+        fail("Size of ${input} is not 6.")
+      }
+      $output = chop($input)
+      if size($output) != 4 {
+        fail("Size of ${input} is not 4.")
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+
+    it 'should not fail on empty strings' do
+      pp = <<-EOS
+      $input = ""
+      $output = chop($input)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/concat_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,18 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should concat one array to another' do
+      pp = <<-EOS
+      $output = concat(['1','2','3'],['4','5','6'])
+      validate_array($output)
+      if size($output) != 6 {
+        fail("${output} should have 6 elements.")
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/count_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,30 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should count elements in an array' do
+      pp = <<-EOS
+      $input = [1,2,3,4]
+      $output = count($input)
+      notify { "$output": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 4/)
+      end
+    end
+
+    it 'should count elements in an array that match a second argument' do
+      pp = <<-EOS
+      $input = [1,1,1,2]
+      $output = count($input, 1)
+      notify { "$output": }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 3/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/deep_merge_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,20 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should deep merge two hashes' do
+      pp = <<-EOS
+      $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+      $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+      $merged_hash = deep_merge($hash1, $hash2)
+
+      if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } {
+        fail("Hash was incorrectly merged.")
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/defined_with_params_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should successfully notify' do
+      pp = <<-EOS
+      user { 'dan':
+        ensure => present,
+      }
+
+      if defined_with_params(User[dan], {'ensure' => 'present' }) {
+        notify { 'User defined with ensure=>present': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: User defined with ensure=>present/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/delete_at_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should delete elements of the array' do
+      pp = <<-EOS
+      $output = delete_at(['a','b','c','b'], 1)
+      if $output == ['a','c','b'] {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/delete_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should delete elements of the array' do
+      pp = <<-EOS
+      $output = delete(['a','b','c','b'], 'b')
+      if $output == ['a','c'] {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/delete_undef_values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should delete elements of the array' do
+      pp = <<-EOS
+      $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})
+      if $output == { a => 'A', b => '', d => false } {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/delete_values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,25 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'delete_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should delete elements of the hash' do
+      pp = <<-EOS
+      $a = { 'a' => 'A', 'b' => 'B', 'B' => 'C', 'd' => 'B' }
+      $b = { 'a' => 'A', 'B' => 'C' }
+      $o = delete_values($a, 'B')
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles non-hash arguments'
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/difference_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'difference function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'returns non-duplicates in the first array' do
+      pp = <<-EOS
+      $a = ['a','b','c']
+      $b = ['b','c','d']
+      $c = ['a']
+      $o = difference($a, $b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles non-array arguments'
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/dirname_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,42 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'dirname function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    context 'absolute path' do
+      it 'returns the dirname' do
+        pp = <<-EOS
+        $a = '/path/to/a/file.txt'
+        $b = '/path/to/a'
+        $o = dirname($a)
+        if $o == $b {
+          notify { 'output correct': }
+        }
+        EOS
+
+        apply_manifest(pp, :catch_failures => true) do |r|
+          expect(r.stdout).to match(/Notice: output correct/)
+        end
+      end
+    end
+    context 'relative path' do
+      it 'returns the dirname' do
+        pp = <<-EOS
+        $a = 'path/to/a/file.txt'
+        $b = 'path/to/a'
+        $o = dirname($a)
+        if $o == $b {
+          notify { 'output correct': }
+        }
+        EOS
+
+        apply_manifest(pp, :catch_failures => true) do |r|
+          expect(r.stdout).to match(/Notice: output correct/)
+        end
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/downcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'downcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'returns the downcase' do
+      pp = <<-EOS
+      $a = 'AOEU'
+      $b = 'aoeu'
+      $o = downcase($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'doesn\'t affect lowercase words' do
+      pp = <<-EOS
+      $a = 'aoeu aoeu'
+      $b = 'aoeu aoeu'
+      $o = downcase($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/empty_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'empty function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'recognizes empty strings' do
+      pp = <<-EOS
+      $a = ''
+      $b = true
+      $o = empty($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'recognizes non-empty strings' do
+      pp = <<-EOS
+      $a = 'aoeu'
+      $b = false
+      $o = empty($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/ensure_packages_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'ensure_packages function', :unless => fact('osfamily') =~ /windows/i do
+  describe 'success' do
+    it 'ensure_packages a package' do
+      apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
+      pp = <<-EOS
+      $a = "rake"
+      ensure_packages($a,{'provider' => 'gem'})
+      EOS
+
+      apply_manifest(pp, :expect_changes => true)
+    end
+    it 'ensures a package already declared'
+    it 'takes defaults arguments'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/ensure_resource_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'ensure_resource function', :unless => fact('osfamily') =~ /windows/i do
+  describe 'success' do
+    it 'ensure_resource a package' do
+      apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
+      pp = <<-EOS
+      $a = "rake"
+      ensure_resource('package', $a, {'provider' => 'gem'})
+      EOS
+
+      apply_manifest(pp, :expect_changes => true)
+    end
+    it 'ensures a resource already declared'
+    it 'takes defaults arguments'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/flatten_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'flatten function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'flattens arrays' do
+      pp = <<-EOS
+      $a = ["a","b",["c",["d","e"],"f","g"]]
+      $b = ["a","b","c","d","e","f","g"]
+      $o = flatten($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'does not affect flat arrays' do
+      pp = <<-EOS
+      $a = ["a","b","c","d","e","f","g"]
+      $b = ["a","b","c","d","e","f","g"]
+      $o = flatten($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/floor_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'floor function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'floors floats' do
+      pp = <<-EOS
+      $a = 12.8
+      $b = 12
+      $o = floor($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'floors integers' do
+      pp = <<-EOS
+      $a = 7
+      $b = 7
+      $o = floor($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-numbers'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/fqdn_rotate_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,47 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    let(:facts_d) do
+      if fact('is_pe', '--puppet') == "true"
+        if fact('osfamily') =~ /windows/i
+          if fact('kernelmajversion').to_f < 6.0
+            'C:/Documents and Settings/All Users/Application Data/PuppetLabs/facter/facts.d'
+          else
+            'C:/ProgramData/PuppetLabs/facter/facts.d'
+          end
+        else
+          '/etc/puppetlabs/facter/facts.d'
+        end
+      else
+        '/etc/facter/facts.d'
+      end
+    end
+    after :each do
+      shell("if [ -f '#{facts_d}/fqdn.txt' ] ; then rm '#{facts_d}/fqdn.txt' ; fi")
+    end
+    before :all do
+      #No need to create on windows, PE creates by default
+      if fact('osfamily') !~ /windows/i
+        shell("mkdir -p '#{facts_d}'")
+      end
+    end
+    it 'fqdn_rotates floats' do
+      shell("echo fqdn=fakehost.localdomain > '#{facts_d}/fqdn.txt'")
+      pp = <<-EOS
+      $a = ['a','b','c','d']
+      $o = fqdn_rotate($a)
+      notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/fqdn_rotate is \["c", "d", "a", "b"\]/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-numbers'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/get_module_path_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'get_module_paths dne' do
+      pp = <<-EOS
+      $a = $::is_pe ? {
+        'true'  => '/etc/puppetlabs/puppet/modules/dne',
+        'false' => '/etc/puppet/modules/dne',
+      }
+      $o = get_module_path('dne')
+      if $o == $a {
+        notify { 'output correct': }
+      } else {
+        notify { "failed; module path is '$o'": }
+      }
+      EOS
+
+      apply_manifest(pp, :expect_failures => true)
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-numbers'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/getparam_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'getparam a notify' do
+      pp = <<-EOS
+      notify { 'rspec':
+        message => 'custom rspec message',
+      }
+      $o = getparam(Notify['rspec'], 'message')
+      notice(inline_template('getparam is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/getparam is "custom rspec message"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/getvar_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'getvar function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'getvars from classes' do
+      pp = <<-EOS
+      class a::data { $foo = 'aoeu' }
+      include a::data
+      $b = 'aoeu'
+      $o = getvar("a::data::foo")
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-numbers'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/grep_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'grep function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'greps arrays' do
+      pp = <<-EOS
+      $a = ['aaabbb','bbbccc','dddeee']
+      $b = 'bbb'
+      $c = ['aaabbb','bbbccc']
+      $o = grep($a,$b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/has_interface_with_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,54 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
+  describe 'success' do
+    it 'has_interface_with existing ipaddress' do
+      pp = <<-EOS
+      $a = $::ipaddress
+      $o = has_interface_with('ipaddress', $a)
+      notice(inline_template('has_interface_with is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_interface_with is true/)
+      end
+    end
+    it 'has_interface_with absent ipaddress' do
+      pp = <<-EOS
+      $a = '128.0.0.1'
+      $o = has_interface_with('ipaddress', $a)
+      notice(inline_template('has_interface_with is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_interface_with is false/)
+      end
+    end
+    it 'has_interface_with existing interface' do
+      pp = <<-EOS
+      if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
+        $a = 'lo0'
+      }elsif $osfamily == 'windows' {
+        $a = $::kernelmajversion ? {
+          /6\.(2|3|4)/ => 'Ethernet0',
+          /6\.(0|1)/ => 'Local_Area_Connection',
+          /5\.(1|2)/  => undef, #Broken current in facter
+        }
+      }else {
+        $a = 'lo'
+      }
+      $o = has_interface_with($a)
+      notice(inline_template('has_interface_with is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_interface_with is true/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/has_ip_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'has_ip_address function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
+  describe 'success' do
+    it 'has_ip_address existing ipaddress' do
+      pp = <<-EOS
+      $a = '127.0.0.1'
+      $o = has_ip_address($a)
+      notice(inline_template('has_ip_address is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_ip_address is true/)
+      end
+    end
+    it 'has_ip_address absent ipaddress' do
+      pp = <<-EOS
+      $a = '128.0.0.1'
+      $o = has_ip_address($a)
+      notice(inline_template('has_ip_address is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_ip_address is false/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/has_ip_network_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'has_ip_network function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
+  describe 'success' do
+    it 'has_ip_network existing ipaddress' do
+      pp = <<-EOS
+      $a = '127.0.0.0'
+      $o = has_ip_network($a)
+      notice(inline_template('has_ip_network is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_ip_network is true/)
+      end
+    end
+    it 'has_ip_network absent ipaddress' do
+      pp = <<-EOS
+      $a = '128.0.0.0'
+      $o = has_ip_network($a)
+      notice(inline_template('has_ip_network is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/has_ip_network is false/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/has_key_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,41 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'has_key function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'has_keys in hashes' do
+      pp = <<-EOS
+      $a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' }
+      $b = 'bbb'
+      $c = true
+      $o = has_key($a,$b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'has_keys not in hashes' do
+      pp = <<-EOS
+      $a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' }
+      $b = 'ccc'
+      $c = false
+      $o = has_key($a,$b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-hashes'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/hash_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'hashs arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','bbb','ccc','ddd','eee']
+      $b = { 'aaa' => 'bbb', 'bbb' => 'ccc', 'ddd' => 'eee' }
+      $o = hash($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'handles odd-length arrays'
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/intersection_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'intersection function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'intersections arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','ccc']
+      $b = ['bbb','ccc','ddd','eee']
+      $c = ['bbb','ccc']
+      $o = intersection($a,$b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'intersections empty arrays'
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_array_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,67 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_arrays arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','ccc']
+      $b = true
+      $o = is_array($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_arrays empty arrays' do
+      pp = <<-EOS
+      $a = []
+      $b = true
+      $o = is_array($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_arrays strings' do
+      pp = <<-EOS
+      $a = "aoeu"
+      $b = false
+      $o = is_array($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_arrays hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'bbb'}
+      $b = false
+      $o = is_array($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,81 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_bools arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','ccc']
+      $b = false
+      $o = is_bool($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_bools true' do
+      pp = <<-EOS
+      $a = true
+      $b = true
+      $o = is_bool($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_bools false' do
+      pp = <<-EOS
+      $a = false
+      $b = true
+      $o = is_bool($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_bools strings' do
+      pp = <<-EOS
+      $a = "true"
+      $b = false
+      $o = is_bool($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_bools hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'bbb'}
+      $b = false
+      $o = is_bool($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_domain_name_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,83 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_domain_name function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_domain_names arrays' do
+      pp = <<-EOS
+      $a = ['aaa.com','bbb','ccc']
+      $o = is_domain_name($a)
+      notice(inline_template('is_domain_name is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_domain_name is false/)
+      end
+    end
+    it 'is_domain_names true' do
+      pp = <<-EOS
+      $a = true
+      $o = is_domain_name($a)
+      notice(inline_template('is_domain_name is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_domain_name is false/)
+      end
+    end
+    it 'is_domain_names false' do
+      pp = <<-EOS
+      $a = false
+      $o = is_domain_name($a)
+      notice(inline_template('is_domain_name is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_domain_name is false/)
+      end
+    end
+    it 'is_domain_names strings with hyphens' do
+      pp = <<-EOS
+      $a = "3foo-bar.2bar-fuzz.com"
+      $b = true
+      $o = is_domain_name($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_domain_names strings beginning with hyphens' do
+      pp = <<-EOS
+      $a = "-bar.2bar-fuzz.com"
+      $b = false
+      $o = is_domain_name($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_domain_names hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'www.com'}
+      $o = is_domain_name($a)
+      notice(inline_template('is_domain_name is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_domain_name is false/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_float_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,86 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_floats arrays' do
+      pp = <<-EOS
+      $a = ['aaa.com','bbb','ccc']
+      $o = is_float($a)
+      notice(inline_template('is_float is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_float is false/)
+      end
+    end
+    it 'is_floats true' do
+      pp = <<-EOS
+      $a = true
+      $o = is_float($a)
+      notice(inline_template('is_float is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_float is false/)
+      end
+    end
+    it 'is_floats strings' do
+      pp = <<-EOS
+      $a = "3.5"
+      $b = true
+      $o = is_float($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_floats floats' do
+      pp = <<-EOS
+      $a = 3.5
+      $b = true
+      $o = is_float($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_floats integers' do
+      pp = <<-EOS
+      $a = 3
+      $b = false
+      $o = is_float($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_floats hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'www.com'}
+      $o = is_float($a)
+      notice(inline_template('is_float is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_float is false/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_function_available_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,58 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_function_available function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_function_availables arrays' do
+      pp = <<-EOS
+      $a = ['fail','include','require']
+      $o = is_function_available($a)
+      notice(inline_template('is_function_available is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_function_available is false/)
+      end
+    end
+    it 'is_function_availables true' do
+      pp = <<-EOS
+      $a = true
+      $o = is_function_available($a)
+      notice(inline_template('is_function_available is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_function_available is false/)
+      end
+    end
+    it 'is_function_availables strings' do
+      pp = <<-EOS
+      $a = "fail"
+      $b = true
+      $o = is_function_available($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_function_availables function_availables' do
+      pp = <<-EOS
+      $a = "is_function_available"
+      $o = is_function_available($a)
+      notice(inline_template('is_function_available is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_function_available is true/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_hash_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,63 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_hashs arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','ccc']
+      $o = is_hash($a)
+      notice(inline_template('is_hash is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_hash is false/)
+      end
+    end
+    it 'is_hashs empty hashs' do
+      pp = <<-EOS
+      $a = {}
+      $b = true
+      $o = is_hash($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_hashs strings' do
+      pp = <<-EOS
+      $a = "aoeu"
+      $b = false
+      $o = is_hash($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_hashs hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'bbb'}
+      $b = true
+      $o = is_hash($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_integer_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,95 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_integer function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_integers arrays' do
+      pp = <<-EOS
+      $a = ['aaa.com','bbb','ccc']
+      $b = false
+      $o = is_integer($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_integers true' do
+      pp = <<-EOS
+      $a = true
+      $b = false
+      $o = is_integer($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_integers strings' do
+      pp = <<-EOS
+      $a = "3"
+      $b = true
+      $o = is_integer($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_integers floats' do
+      pp = <<-EOS
+      $a = 3.5
+      $b = false
+      $o = is_integer($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_integers integers' do
+      pp = <<-EOS
+      $a = 3
+      $b = true
+      $o = is_integer($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_integers hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'www.com'}
+      $b = false
+      $o = is_integer($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_ip_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,80 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_ip_addresss ipv4' do
+      pp = <<-EOS
+      $a = '1.2.3.4'
+      $b = true
+      $o = is_ip_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_ip_addresss ipv6' do
+      pp = <<-EOS
+      $a = "fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"
+      $b = true
+      $o = is_ip_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_ip_addresss ipv6 compressed' do
+      pp = <<-EOS
+      $a = "fe00::1"
+      $b = true
+      $o = is_ip_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_ip_addresss strings' do
+      pp = <<-EOS
+      $a = "aoeu"
+      $b = false
+      $o = is_ip_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_ip_addresss ipv4 out of range' do
+      pp = <<-EOS
+      $a = '1.2.3.400'
+      $b = false
+      $o = is_ip_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_mac_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,38 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_mac_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_mac_addresss a mac' do
+      pp = <<-EOS
+      $a = '00:a0:1f:12:7f:a0'
+      $b = true
+      $o = is_mac_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_mac_addresss a mac out of range' do
+      pp = <<-EOS
+      $a = '00:a0:1f:12:7f:g0'
+      $b = false
+      $o = is_mac_address($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_numeric_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,95 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_numeric function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_numerics arrays' do
+      pp = <<-EOS
+      $a = ['aaa.com','bbb','ccc']
+      $b = false
+      $o = is_numeric($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_numerics true' do
+      pp = <<-EOS
+      $a = true
+      $b = false
+      $o = is_numeric($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_numerics strings' do
+      pp = <<-EOS
+      $a = "3"
+      $b = true
+      $o = is_numeric($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_numerics floats' do
+      pp = <<-EOS
+      $a = 3.5
+      $b = true
+      $o = is_numeric($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_numerics integers' do
+      pp = <<-EOS
+      $a = 3
+      $b = true
+      $o = is_numeric($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_numerics hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'www.com'}
+      $b = false
+      $o = is_numeric($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+    it 'handles non-arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/is_string_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,102 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'is_strings arrays' do
+      pp = <<-EOS
+      $a = ['aaa.com','bbb','ccc']
+      $b = false
+      $o = is_string($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_strings true' do
+      pp = <<-EOS
+      $a = true
+      $b = false
+      $o = is_string($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_strings strings' do
+      pp = <<-EOS
+      $a = "aoeu"
+      $o = is_string($a)
+      notice(inline_template('is_string is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_string is true/)
+      end
+    end
+    it 'is_strings number strings' do
+      pp = <<-EOS
+      $a = "3"
+      $o = is_string($a)
+      notice(inline_template('is_string is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/is_string is false/)
+      end
+    end
+    it 'is_strings floats' do
+      pp = <<-EOS
+      $a = 3.5
+      $b = false
+      $o = is_string($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_strings integers' do
+      pp = <<-EOS
+      $a = 3
+      $b = false
+      $o = is_string($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'is_strings hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'www.com'}
+      $b = false
+      $o = is_string($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/join_keys_to_values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'join_keys_to_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'join_keys_to_valuess hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'bbb','ccc'=>'ddd'}
+      $b = ':'
+      $o = join_keys_to_values($a,$b)
+      notice(inline_template('join_keys_to_values is <%= @o.sort.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/join_keys_to_values is \["aaa:bbb", "ccc:ddd"\]/)
+      end
+    end
+    it 'handles non hashes'
+    it 'handles empty hashes'
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/join_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'join function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'joins arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','ccc']
+      $b = ':'
+      $c = 'aaa:bbb:ccc'
+      $o = join($a,$b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'handles non arrays'
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/keys_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,23 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'keys function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'keyss hashes' do
+      pp = <<-EOS
+      $a = {'aaa'=>'bbb','ccc'=>'ddd'}
+      $o = keys($a)
+      notice(inline_template('keys is <%= @o.sort.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/keys is \["aaa", "ccc"\]/)
+      end
+    end
+    it 'handles non hashes'
+    it 'handles empty hashes'
+  end
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/loadyaml_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+tmpdir = default.tmpdir('stdlib')
+
+describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'loadyamls array of values' do
+      shell("echo '---
+      aaa: 1
+      bbb: 2
+      ccc: 3
+      ddd: 4' > #{tmpdir}/testyaml.yaml")
+      pp = <<-EOS
+      $o = loadyaml('#{tmpdir}/testyaml.yaml')
+      notice(inline_template('loadyaml[aaa] is <%= @o["aaa"].inspect %>'))
+      notice(inline_template('loadyaml[bbb] is <%= @o["bbb"].inspect %>'))
+      notice(inline_template('loadyaml[ccc] is <%= @o["ccc"].inspect %>'))
+      notice(inline_template('loadyaml[ddd] is <%= @o["ddd"].inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/loadyaml\[aaa\] is 1/)
+        expect(r.stdout).to match(/loadyaml\[bbb\] is 2/)
+        expect(r.stdout).to match(/loadyaml\[ccc\] is 3/)
+        expect(r.stdout).to match(/loadyaml\[ddd\] is 4/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'fails with no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/lstrip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'lstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'lstrips arrays' do
+      pp = <<-EOS
+      $a = ["  the   ","   public   ","   art","galleries   "]
+      # Anagram: Large picture halls, I bet
+      $o = lstrip($a)
+      notice(inline_template('lstrip is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/lstrip is \["the   ", "public   ", "art", "galleries   "\]/)
+      end
+    end
+    it 'lstrips strings' do
+      pp = <<-EOS
+      $a = "   blowzy night-frumps vex'd jack q   "
+      $o = lstrip($a)
+      notice(inline_template('lstrip is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/lstrip is "blowzy night-frumps vex'd jack q   "/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/max_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,20 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'max function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'maxs arrays' do
+      pp = <<-EOS
+      $o = max("the","public","art","galleries")
+      notice(inline_template('max is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/max is "the"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/member_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,54 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  shared_examples 'item found' do
+    it 'should output correctly' do
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+  end
+  describe 'success' do
+    it 'members arrays' do
+      pp = <<-EOS
+      $a = ['aaa','bbb','ccc']
+      $b = 'ccc'
+      $c = true
+      $o = member($a,$b)
+      if $o == $c {
+        notify { 'output correct': }
+      }
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    describe 'members array of integers' do
+      it_should_behave_like 'item found' do
+        let(:pp) { <<-EOS
+      if member( [1,2,3,4], 4 ){
+        notify { 'output correct': }
+      }
+        EOS
+        }
+      end
+    end
+    describe 'members of mixed array' do
+      it_should_behave_like 'item found' do
+        let(:pp) { <<-EOS
+      if member( ['a','4',3], 'a' ){
+        notify { 'output correct': }
+}
+        EOS
+        }
+      end
+    end
+    it 'members arrays without members'
+  end
+
+  describe 'failure' do
+    it 'handles improper argument counts'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/merge_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,23 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'should merge two hashes' do
+      pp = <<-EOS
+      $a = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+      $b = {'two' => 'dos', 'three' => { 'five' => 5 } }
+      $o = merge($a, $b)
+      notice(inline_template('merge[one]   is <%= @o["one"].inspect %>'))
+      notice(inline_template('merge[two]   is <%= @o["two"].inspect %>'))
+      notice(inline_template('merge[three] is <%= @o["three"].inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/merge\[one\]   is ("1"|1)/)
+        expect(r.stdout).to match(/merge\[two\]   is "dos"/)
+        expect(r.stdout).to match(/merge\[three\] is {"five"=>("5"|5)}/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/min_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,20 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'min function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'mins arrays' do
+      pp = <<-EOS
+      $o = min("the","public","art","galleries")
+      notice(inline_template('min is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/min is "art"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/centos-59-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  centos-59-x64:
+    roles:
+      - master
+    platform: el-5-x86_64
+    box : centos-59-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: git
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/centos-6-vcloud.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,15 @@
+HOSTS:
+  'centos-6-vcloud':
+    roles:
+      - master
+    platform: el-6-x86_64
+    hypervisor: vcloud
+    template: centos-6-x86_64
+CONFIG:
+  type: foss
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/centos-64-x64-pe.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,12 @@
+HOSTS:
+  centos-64-x64:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: el-6-x86_64
+    box : centos-64-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: pe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/centos-64-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  centos-64-x64:
+    roles:
+      - master
+    platform: el-6-x86_64
+    box : centos-64-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/centos-65-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  centos-65-x64:
+    roles:
+      - master
+    platform: el-6-x86_64
+    box : centos-65-x64-vbox436-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/default.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  centos-65-x64:
+    roles:
+      - master
+    platform: el-6-x86_64
+    box : centos-65-x64-vbox436-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/fedora-18-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  fedora-18-x64:
+    roles:
+      - master
+    platform: fedora-18-x86_64
+    box : fedora-18-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/sles-11-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  sles-11-x64.local:
+    roles:
+      - master
+    platform: sles-11-x64
+    box : sles-11sp1-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+    type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  ubuntu-server-10044-x64:
+    roles:
+      - master
+    platform: ubuntu-10.04-amd64
+    box : ubuntu-server-10044-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+HOSTS:
+  ubuntu-server-12042-x64:
+    roles:
+      - master
+    platform: ubuntu-12.04-amd64
+    box : ubuntu-server-12042-x64-vbox4210-nocm
+    box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
+    hypervisor : vagrant
+CONFIG:
+  type: foss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,11 @@
+HOSTS:
+  ubuntu-server-1404-x64:
+    roles:
+      - master
+    platform: ubuntu-14.04-amd64
+    box : puppetlabs/ubuntu-14.04-64-nocm
+    box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
+    hypervisor : vagrant
+CONFIG:
+  log_level   : debug
+  type: git
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/windows-2003-i386.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+HOSTS:
+  ubuntu1204:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: ubuntu-12.04-amd64
+    template: ubuntu-1204-x86_64
+    hypervisor: vcloud
+  win2003_i386:
+    roles:
+      - agent
+      - default
+    platform: windows-2003-i386
+    template: win-2003-i386
+    hypervisor: vcloud
+CONFIG:
+  nfs_server: none
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  consoleport: 443
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
+  pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/windows-2003-x86_64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+HOSTS:
+  ubuntu1204:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: ubuntu-12.04-amd64
+    template: ubuntu-1204-x86_64
+    hypervisor: vcloud
+  win2003_x86_64:
+    roles:
+      - agent
+      - default
+    platform: windows-2003-x86_64
+    template: win-2003-x86_64
+    hypervisor: vcloud
+CONFIG:
+  nfs_server: none
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  consoleport: 443
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
+  pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/windows-2008-x86_64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+HOSTS:
+  ubuntu1204:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: ubuntu-12.04-amd64
+    template: ubuntu-1204-x86_64
+    hypervisor: vcloud
+  win2008_x86_64:
+    roles:
+      - agent
+      - default
+    platform: windows-2008-x86_64
+    template: win-2008-x86_64
+    hypervisor: vcloud
+CONFIG:
+  nfs_server: none
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  consoleport: 443
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
+  pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/windows-2008r2-x86_64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+HOSTS:
+  ubuntu1204:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: ubuntu-12.04-amd64
+    template: ubuntu-1204-x86_64
+    hypervisor: vcloud
+  win2008r2:
+    roles:
+      - agent
+      - default
+    platform: windows-2008r2-x86_64
+    template: win-2008r2-x86_64
+    hypervisor: vcloud
+CONFIG:
+  nfs_server: none
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  consoleport: 443
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
+  pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/windows-2012-x86_64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+HOSTS:
+  ubuntu1204:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: ubuntu-12.04-amd64
+    template: ubuntu-1204-x86_64
+    hypervisor: vcloud
+  win2012:
+    roles:
+      - agent
+      - default
+    platform: windows-2012-x86_64
+    template: win-2012-x86_64
+    hypervisor: vcloud
+CONFIG:
+  nfs_server: none
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  consoleport: 443
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
+  pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/nodesets/windows-2012r2-x86_64.yml	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,26 @@
+HOSTS:
+  ubuntu1204:
+    roles:
+      - master
+      - database
+      - dashboard
+    platform: ubuntu-12.04-amd64
+    template: ubuntu-1204-x86_64
+    hypervisor: vcloud
+  win2012r2:
+    roles:
+      - agent
+      - default
+    platform: windows-2012r2-x86_64
+    template: win-2012r2-x86_64
+    hypervisor: vcloud
+CONFIG:
+  nfs_server: none
+  ssh:
+    keys: "~/.ssh/id_rsa-acceptance"
+  consoleport: 443
+  datastore: instance0
+  folder: Delivery/Quality Assurance/Enterprise/Dynamic
+  resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+  pooling_api: http://vcloud.delivery.puppetlabs.net/
+  pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/num2bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,76 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'num2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'bools positive numbers and numeric strings as true' do
+      pp = <<-EOS
+      $a = 1
+      $b = "1"
+      $c = "50"
+      $ao = num2bool($a)
+      $bo = num2bool($b)
+      $co = num2bool($c)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      notice(inline_template('b is <%= @bo.inspect %>'))
+      notice(inline_template('c is <%= @co.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/a is true/)
+        expect(r.stdout).to match(/b is true/)
+        expect(r.stdout).to match(/c is true/)
+      end
+    end
+    it 'bools negative numbers as false' do
+      pp = <<-EOS
+      $a = 0
+      $b = -0.1
+      $c = ["-50","1"]
+      $ao = num2bool($a)
+      $bo = num2bool($b)
+      $co = num2bool($c)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      notice(inline_template('b is <%= @bo.inspect %>'))
+      notice(inline_template('c is <%= @co.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/a is false/)
+        expect(r.stdout).to match(/b is false/)
+        expect(r.stdout).to match(/c is false/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'fails on words' do
+      pp = <<-EOS
+      $a = "a"
+      $ao = num2bool($a)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      EOS
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not look like a number/)
+    end
+
+    it 'fails on numberwords' do
+      pp = <<-EOS
+      $b = "1b"
+      $bo = num2bool($b)
+      notice(inline_template('b is <%= @bo.inspect %>'))
+      EOS
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not look like a number/)
+
+    end
+
+    it 'fails on non-numeric/strings' do
+      pending "The function will call .to_s.to_i on anything not a Numeric or
+      String, and results in 0. Is this intended?"
+      pp = <<-EOS
+      $c = {"c" => "-50"}
+      $co = num2bool($c)
+      notice(inline_template('c is <%= @co.inspect %>'))
+      EOS
+      expect(apply_manifest(ppc :expect_failures => true).stderr).to match(/Unable to parse/)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/parsejson_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'parsejson function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'parses valid json' do
+      pp = <<-EOS
+      $a = '{"hunter": "washere", "tests": "passing"}'
+      $ao = parsejson($a)
+      $tests = $ao['tests']
+      notice(inline_template('tests are <%= @tests.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/tests are "passing"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'raises error on incorrect json' do
+      pp = <<-EOS
+      $a = '{"hunter": "washere", "tests": "passing",}'
+      $ao = parsejson($a)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :expect_failures => true) do |r|
+        expect(r.stderr).to match(/expected next name/)
+      end
+    end
+
+    it 'raises error on incorrect number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/parseyaml_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,35 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'parses valid yaml' do
+      pp = <<-EOS
+      $a = "---\nhunter: washere\ntests: passing\n"
+      $o = parseyaml($a)
+      $tests = $o['tests']
+      notice(inline_template('tests are <%= @tests.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/tests are "passing"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'raises error on incorrect yaml' do
+      pp = <<-EOS
+      $a = "---\nhunter: washere\ntests: passing\n:"
+      $o = parseyaml($a)
+      $tests = $o['tests']
+      notice(inline_template('tests are <%= @tests.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :expect_failures => true) do |r|
+        expect(r.stderr).to match(/(syntax error|did not find expected key)/)
+      end
+    end
+
+    it 'raises error on incorrect number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/pick_default_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,54 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'pick_default function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'pick_defaults a default value' do
+      pp = <<-EOS
+      $a = undef
+      $o = pick_default($a, 'default')
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/picked is "default"/)
+      end
+    end
+    it 'pick_defaults with no value' do
+      pp = <<-EOS
+      $a = undef
+      $b = undef
+      $o = pick_default($a,$b)
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/picked is ""/)
+      end
+    end
+    it 'pick_defaults the first set value' do
+      pp = <<-EOS
+      $a = "something"
+      $b = "long"
+      $o = pick_default($a, $b, 'default')
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/picked is "something"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'raises error with no values' do
+      pp = <<-EOS
+      $o = pick_default()
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :expect_failures => true) do |r|
+        expect(r.stderr).to match(/Must receive at least one argument/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/pick_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,44 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'pick function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'picks a default value' do
+      pp = <<-EOS
+      $a = undef
+      $o = pick($a, 'default')
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/picked is "default"/)
+      end
+    end
+    it 'picks the first set value' do
+      pp = <<-EOS
+      $a = "something"
+      $b = "long"
+      $o = pick($a, $b, 'default')
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/picked is "something"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'raises error with all undef values' do
+      pp = <<-EOS
+      $a = undef
+      $b = undef
+      $o = pick($a, $b)
+      notice(inline_template('picked is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :expect_failures => true) do |r|
+        expect(r.stderr).to match(/must receive at least one non empty value/)
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/prefix_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,42 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'prefix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'prefixes array of values' do
+      pp = <<-EOS
+      $o = prefix(['a','b','c'],'p')
+      notice(inline_template('prefix is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/prefix is \["pa", "pb", "pc"\]/)
+      end
+    end
+    it 'prefixs with empty array' do
+      pp = <<-EOS
+      $o = prefix([],'p')
+      notice(inline_template('prefix is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/prefix is \[\]/)
+      end
+    end
+    it 'prefixs array of values with undef' do
+      pp = <<-EOS
+      $o = prefix(['a','b','c'], undef)
+      notice(inline_template('prefix is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/prefix is \["a", "b", "c"\]/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'fails with no arguments'
+    it 'fails when first argument is not array'
+    it 'fails when second argument is not string'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/range_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,36 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'range function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'ranges letters' do
+      pp = <<-EOS
+      $o = range('a','d')
+      notice(inline_template('range is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/range is \["a", "b", "c", "d"\]/)
+      end
+    end
+    it 'ranges letters with a step' do
+      pp = <<-EOS
+      $o = range('a','d', '2')
+      notice(inline_template('range is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/range is \["a", "c"\]/)
+      end
+    end
+    it 'ranges letters with a negative step'
+    it 'ranges numbers'
+    it 'ranges numbers with a step'
+    it 'ranges numbers with a negative step'
+    it 'ranges numeric strings'
+    it 'ranges zero padded numbers'
+  end
+  describe 'failure' do
+    it 'fails with no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/reject_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,42 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'reject function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'rejects array of values' do
+      pp = <<-EOS
+      $o = reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
+      notice(inline_template('reject is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/reject is \["bbb", "ccc"\]/)
+      end
+    end
+    it 'rejects with empty array' do
+      pp = <<-EOS
+      $o = reject([],'aaa')
+      notice(inline_template('reject is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/reject is \[\]/)
+      end
+    end
+    it 'rejects array of values with undef' do
+      pp = <<-EOS
+      $o = reject(['aaa','bbb','ccc','aaaddd'], undef)
+      notice(inline_template('reject is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/reject is \[\]/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'fails with no arguments'
+    it 'fails when first argument is not array'
+    it 'fails when second argument is not string'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/reverse_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,23 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'reverse function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'reverses strings' do
+      pp = <<-EOS
+      $a = "the public art galleries"
+      # Anagram: Large picture halls, I bet
+      $o = reverse($a)
+      notice(inline_template('reverse is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/reverse is "seirellag tra cilbup eht"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/rstrip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'rstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'rstrips arrays' do
+      pp = <<-EOS
+      $a = ["  the   ","   public   ","   art","galleries   "]
+      # Anagram: Large picture halls, I bet
+      $o = rstrip($a)
+      notice(inline_template('rstrip is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/rstrip is \["  the", "   public", "   art", "galleries"\]/)
+      end
+    end
+    it 'rstrips strings' do
+      pp = <<-EOS
+      $a = "   blowzy night-frumps vex'd jack q   "
+      $o = rstrip($a)
+      notice(inline_template('rstrip is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/rstrip is "   blowzy night-frumps vex'd jack q"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/shuffle_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'shuffles arrays' do
+      pp = <<-EOS
+      $a = ["1", "2", "3", "4", "5", "6", "7", "8", "the","public","art","galleries"]
+      # Anagram: Large picture halls, I bet
+      $o = shuffle($a)
+      notice(inline_template('shuffle is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to_not match(/shuffle is \["1", "2", "3", "4", "5", "6", "7", "8", "the", "public", "art", "galleries"\]/)
+      end
+    end
+    it 'shuffles strings' do
+      pp = <<-EOS
+      $a = "blowzy night-frumps vex'd jack q"
+      $o = shuffle($a)
+      notice(inline_template('shuffle is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to_not match(/shuffle is "blowzy night-frumps vex'd jack q"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/size_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,55 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'size function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'single string size' do
+      pp = <<-EOS
+      $a = 'discombobulate'
+      $o = size($a)
+      notice(inline_template('size is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/size is 14/)
+      end
+    end
+    it 'with empty string' do
+      pp = <<-EOS
+      $a = ''
+      $o = size($a)
+      notice(inline_template('size is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/size is 0/)
+      end
+    end
+    it 'with undef' do
+      pp = <<-EOS
+      $a = undef
+      $o = size($a)
+      notice(inline_template('size is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/size is 0/)
+      end
+    end
+    it 'strings in array' do
+      pp = <<-EOS
+      $a = ['discombobulate', 'moo']
+      $o = size($a)
+      notice(inline_template('size is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/size is 2/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/sort_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'sort function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'sorts arrays' do
+      pp = <<-EOS
+      $a = ["the","public","art","galleries"]
+      # Anagram: Large picture halls, I bet
+      $o = sort($a)
+      notice(inline_template('sort is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/sort is \["art", "galleries", "public", "the"\]/)
+      end
+    end
+    it 'sorts strings' do
+      pp = <<-EOS
+      $a = "blowzy night-frumps vex'd jack q"
+      $o = sort($a)
+      notice(inline_template('sort is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/sort is "    '-abcdefghijklmnopqrstuvwxyz"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/squeeze_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,47 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'squeeze function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'squeezes arrays' do
+      pp = <<-EOS
+      # Real words!
+      $a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"]
+      $o = squeeze($a)
+      notice(inline_template('squeeze is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/squeeze is \["wales", "laparohysterosalpingophorectomy", "br", "godeship"\]/)
+      end
+    end
+    it 'squeezez arrays with an argument'
+    it 'squeezes strings' do
+      pp = <<-EOS
+      $a = "wallless laparohysterosalpingooophorectomy brrr goddessship"
+      $o = squeeze($a)
+      notice(inline_template('squeeze is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/squeeze is "wales laparohysterosalpingophorectomy br godeship"/)
+      end
+    end
+
+    it 'squeezes strings with an argument' do
+      pp = <<-EOS
+      $a = "countessship duchessship governessship hostessship"
+      $o = squeeze($a, 's')
+      notice(inline_template('squeeze is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/squeeze is "counteship ducheship governeship hosteship"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/str2bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'str2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'works with "y"' do
+      pp = <<-EOS
+      $o = str2bool('y')
+      notice(inline_template('str2bool is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/str2bool is true/)
+      end
+    end
+    it 'works with "Y"'
+    it 'works with "yes"'
+    it 'works with "1"'
+    it 'works with "true"'
+    it 'works with "n"'
+    it 'works with "N"'
+    it 'works with "no"'
+    it 'works with "0"'
+    it 'works with "false"'
+    it 'works with undef'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non arrays or strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/str2saltedsha512_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'str2saltedsha512 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'works with "y"' do
+      pp = <<-EOS
+      $o = str2saltedsha512('password')
+      notice(inline_template('str2saltedsha512 is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/str2saltedsha512 is "[a-f0-9]{136}"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles more than one argument'
+    it 'handles non strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/strftime_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'strftime function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'gives the Century' do
+      pp = <<-EOS
+      $o = strftime('%C')
+      notice(inline_template('strftime is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/strftime is "20"/)
+      end
+    end
+    it 'takes a timezone argument'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles invalid format strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/strip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'strip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'strips arrays' do
+      pp = <<-EOS
+      $a = ["  the   ","   public   ","   art","galleries   "]
+      # Anagram: Large picture halls, I bet
+      $o = strip($a)
+      notice(inline_template('strip is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/strip is \["the", "public", "art", "galleries"\]/)
+      end
+    end
+    it 'strips strings' do
+      pp = <<-EOS
+      $a = "   blowzy night-frumps vex'd jack q   "
+      $o = strip($a)
+      notice(inline_template('strip is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/strip is "blowzy night-frumps vex'd jack q"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/suffix_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,42 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'suffix function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'suffixes array of values' do
+      pp = <<-EOS
+      $o = suffix(['a','b','c'],'p')
+      notice(inline_template('suffix is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/suffix is \["ap", "bp", "cp"\]/)
+      end
+    end
+    it 'suffixs with empty array' do
+      pp = <<-EOS
+      $o = suffix([],'p')
+      notice(inline_template('suffix is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/suffix is \[\]/)
+      end
+    end
+    it 'suffixs array of values with undef' do
+      pp = <<-EOS
+      $o = suffix(['a','b','c'], undef)
+      notice(inline_template('suffix is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/suffix is \["a", "b", "c"\]/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'fails with no arguments'
+    it 'fails when first argument is not array'
+    it 'fails when second argument is not string'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/swapcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'swapcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'works with strings' do
+      pp = <<-EOS
+      $o = swapcase('aBcD')
+      notice(inline_template('swapcase is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/swapcase is "AbCd"/)
+      end
+    end
+    it 'works with arrays'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non arrays or strings'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/time_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,36 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'time function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'gives the time' do
+      pp = <<-EOS
+      $o = time()
+      notice(inline_template('time is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        m = r.stdout.match(/time is (\d+)\D/)
+
+        # When I wrote this test
+        expect(Integer(m[1])).to be > 1398894170
+      end
+    end
+    it 'takes a timezone argument' do
+      pp = <<-EOS
+      $o = time('UTC')
+      notice(inline_template('time is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        m = r.stdout.match(/time is (\d+)\D/)
+
+        expect(Integer(m[1])).to be > 1398894170
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles more arguments'
+    it 'handles invalid timezones'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/to_bytes_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'to_bytes function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'converts kB to B' do
+      pp = <<-EOS
+      $o = to_bytes('4 kB')
+      notice(inline_template('to_bytes is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        m = r.stdout.match(/to_bytes is (\d+)\D/)
+        expect(m[1]).to eq("4096")
+      end
+    end
+    it 'works without the B in unit'
+    it 'works without a space before unit'
+    it 'works without a unit'
+    it 'converts fractions'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non integer arguments'
+    it 'handles unknown units like uB'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/type_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'type function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || is_future_parser_enabled?) do
+  describe 'success' do
+    it 'types arrays' do
+      pp = <<-EOS
+      $a = ["the","public","art","galleries"]
+      # Anagram: Large picture halls, I bet
+      $o = type($a)
+      notice(inline_template('type is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/type is "array"/)
+      end
+    end
+    it 'types strings' do
+      pp = <<-EOS
+      $a = "blowzy night-frumps vex'd jack q"
+      $o = type($a)
+      notice(inline_template('type is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/type is "string"/)
+      end
+    end
+    it 'types hashes'
+    it 'types integers'
+    it 'types floats'
+    it 'types booleans'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/union_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'union function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'unions arrays' do
+      pp = <<-EOS
+      $a = ["the","public"]
+      $b = ["art","galleries"]
+      # Anagram: Large picture halls, I bet
+      $o = union($a,$b)
+      notice(inline_template('union is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/union is \["the", "public", "art", "galleries"\]/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/unique_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'unique function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'uniques arrays' do
+      pp = <<-EOS
+      $a = ["wallless", "wallless", "brrr", "goddessship"]
+      $o = unique($a)
+      notice(inline_template('unique is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/unique is \["wallless", "brrr", "goddessship"\]/)
+      end
+    end
+    it 'uniques strings' do
+      pp = <<-EOS
+      $a = "wallless laparohysterosalpingooophorectomy brrr goddessship"
+      $o = unique($a)
+      notice(inline_template('unique is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/unique is "wales prohytingcmbd"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/unsupported_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,11 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  it 'should fail' do
+    pp = <<-EOS
+    class { 'mysql::server': }
+    EOS
+    expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/unsupported osfamily/i)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/upcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'upcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'upcases arrays' do
+      pp = <<-EOS
+      $a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"]
+      $o = upcase($a)
+      notice(inline_template('upcase is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/upcase is \["WALLLESS", "LAPAROHYSTEROSALPINGOOOPHORECTOMY", "BRRR", "GODDESSSHIP"\]/)
+      end
+    end
+    it 'upcases strings' do
+      pp = <<-EOS
+      $a = "wallless laparohysterosalpingooophorectomy brrr goddessship"
+      $o = upcase($a)
+      notice(inline_template('upcase is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/upcase is "WALLLESS LAPAROHYSTEROSALPINGOOOPHORECTOMY BRRR GODDESSSHIP"/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/uriescape_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,23 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'uriescape function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'uriescape strings' do
+      pp = <<-EOS
+      $a = ":/?#[]@!$&'()*+,;= \\\"{}"
+      $o = uriescape($a)
+      notice(inline_template('uriescape is <%= @o.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/uriescape is ":\/\?%23\[\]@!\$&'\(\)\*\+,;=%20%22%7B%7D"/)
+      end
+    end
+    it 'does nothing if a string is already safe'
+  end
+  describe 'failure' do
+    it 'handles no arguments'
+    it 'handles non strings or arrays'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_absolute_path_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_absolute_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    %w{
+      C:/
+      C:\\\\
+      C:\\\\WINDOWS\\\\System32
+      C:/windows/system32
+      X:/foo/bar
+      X:\\\\foo\\\\bar
+      /var/tmp
+      /var/lib/puppet
+      /var/opt/../lib/puppet
+    }.each do |path|
+      it "validates a single argument #{path}" do
+        pp = <<-EOS
+        $one = '#{path}'
+        validate_absolute_path($one)
+        EOS
+
+        apply_manifest(pp, :catch_failures => true)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+    it 'handles relative paths'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_array_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single argument' do
+      pp = <<-EOS
+      $one = ['a', 'b']
+      validate_array($one)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an multiple arguments' do
+      pp = <<-EOS
+      $one = ['a', 'b']
+      $two = [['c'], 'd']
+      validate_array($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a non-array' do
+      {
+        %{validate_array({'a' => 'hash' })} => "Hash",
+        %{validate_array('string')}         => "String",
+        %{validate_array(false)}            => "FalseClass",
+        %{validate_array(undef)}            => "String"
+      }.each do |pp,type|
+        expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_augeas_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,63 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_augeas function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do
+  describe 'prep' do
+    it 'installs augeas for tests'
+  end
+  describe 'success' do
+    context 'valid inputs with no 3rd argument' do
+      {
+        'root:x:0:0:root:/root:/bin/bash\n'                        => 'Passwd.lns',
+        'proc /proc   proc    nodev,noexec,nosuid     0       0\n' => 'Fstab.lns'
+      }.each do |line,lens|
+        it "validates a single argument for #{lens}" do
+          pp = <<-EOS
+          $line = "#{line}"
+          $lens = "#{lens}"
+          validate_augeas($line, $lens)
+          EOS
+
+          apply_manifest(pp, :catch_failures => true)
+        end
+      end
+    end
+    context 'valid inputs with 3rd and 4th arguments' do
+      it "validates a restricted value" do
+        line        = 'root:x:0:0:root:/root:/bin/barsh\n'
+        lens        = 'Passwd.lns'
+        restriction = '$file/*[shell="/bin/barsh"]'
+        pp = <<-EOS
+        $line        = "#{line}"
+        $lens        = "#{lens}"
+        $restriction = ['#{restriction}']
+        validate_augeas($line, $lens, $restriction, "my custom failure message")
+        EOS
+
+        expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/my custom failure message/)
+      end
+    end
+    context 'invalid inputs' do
+      {
+        'root:x:0:0:root' => 'Passwd.lns',
+        '127.0.1.1'       => 'Hosts.lns'
+      }.each do |line,lens|
+        it "validates a single argument for #{lens}" do
+          pp = <<-EOS
+          $line = "#{line}"
+          $lens = "#{lens}"
+          validate_augeas($line, $lens)
+          EOS
+
+          apply_manifest(pp, :expect_failures => true)
+        end
+      end
+    end
+    context 'garbage inputs' do
+      it 'raises an error on invalid inputs'
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single argument' do
+      pp = <<-EOS
+      $one = true
+      validate_bool($one)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an multiple arguments' do
+      pp = <<-EOS
+      $one = true
+      $two = false
+      validate_bool($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a non-bool' do
+      {
+        %{validate_bool('true')}  => "String",
+        %{validate_bool('false')} => "String",
+        %{validate_bool([true])}  => "Array",
+        %{validate_bool(undef)}   => "String",
+      }.each do |pp,type|
+        expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_cmd_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,52 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a true command' do
+      pp = <<-EOS
+      $one = 'foo'
+      if $::osfamily == 'windows' {
+        $two = 'echo' #shell built-in
+      } else {
+        $two = '/bin/echo'
+      }
+      validate_cmd($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a fail command' do
+      pp = <<-EOS
+      $one = 'foo'
+      if $::osfamily == 'windows' {
+        $two = 'C:/aoeu'
+      } else {
+        $two = '/bin/aoeu'
+      }
+      validate_cmd($one,$two)
+      EOS
+
+      apply_manifest(pp, :expect_failures => true)
+    end
+    it 'validates a fail command with a custom error message' do
+      pp = <<-EOS
+      $one = 'foo'
+      if $::osfamily == 'windows' {
+        $two = 'C:/aoeu'
+      } else {
+        $two = '/bin/aoeu'
+      }
+      validate_cmd($one,$two,"aoeu is dvorak")
+      EOS
+
+      apply_manifest(pp, :expect_failures => true) do |output|
+        expect(output.stderr).to match(/aoeu is dvorak/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+    it 'handles improper argument types'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_hash_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single argument' do
+      pp = <<-EOS
+      $one = { 'a' => 1 }
+      validate_hash($one)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an multiple arguments' do
+      pp = <<-EOS
+      $one = { 'a' => 1 }
+      $two = { 'b' => 2 }
+      validate_hash($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a non-hash' do
+      {
+        %{validate_hash('{ "not" => "hash" }')} => "String",
+        %{validate_hash('string')}              => "String",
+        %{validate_hash(["array"])}             => "Array",
+        %{validate_hash(undef)}                 => "String",
+      }.each do |pp,type|
+        expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_ipv4_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_ipv4_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single argument' do
+      pp = <<-EOS
+      $one = '1.2.3.4'
+      validate_ipv4_address($one)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an multiple arguments' do
+      pp = <<-EOS
+      $one = '1.2.3.4'
+      $two = '5.6.7.8'
+      validate_ipv4_address($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+    it 'handles ipv6 addresses'
+    it 'handles non-ipv4 strings'
+    it 'handles numbers'
+    it 'handles no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_ipv6_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_ipv6_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single argument' do
+      pp = <<-EOS
+      $one = '3ffe:0505:0002::'
+      validate_ipv6_address($one)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an multiple arguments' do
+      pp = <<-EOS
+      $one = '3ffe:0505:0002::'
+      $two = '3ffe:0505:0001::'
+      validate_ipv6_address($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+    it 'handles ipv6 addresses'
+    it 'handles non-ipv6 strings'
+    it 'handles numbers'
+    it 'handles no arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_re_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,47 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_re function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a string' do
+      pp = <<-EOS
+      $one = 'one'
+      $two = '^one$'
+      validate_re($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an array' do
+      pp = <<-EOS
+      $one = 'one'
+      $two = ['^one$', '^two']
+      validate_re($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a failed array' do
+      pp = <<-EOS
+      $one = 'one'
+      $two = ['^two$', '^three']
+      validate_re($one,$two)
+      EOS
+
+      apply_manifest(pp, :expect_failures => true)
+    end
+    it 'validates a failed array with a custom error message' do
+      pp = <<-EOS
+      $one = '3.4.3'
+      $two = '^2.7'
+      validate_re($one,$two,"The $puppetversion fact does not match 2.7")
+      EOS
+
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/does not match/)
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+    it 'handles improper argument types'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_slength_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,72 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_slength function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single string max' do
+      pp = <<-EOS
+      $one = 'discombobulate'
+      $two = 17
+      validate_slength($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates multiple string maxes' do
+      pp = <<-EOS
+      $one = ['discombobulate', 'moo']
+      $two = 17
+      validate_slength($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates min/max of  strings in array' do
+      pp = <<-EOS
+      $one = ['discombobulate', 'moo']
+      $two = 17
+      $three = 3
+      validate_slength($one,$two,$three)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a single string max of incorrect length' do
+      pp = <<-EOS
+      $one = 'discombobulate'
+      $two = 1
+      validate_slength($one,$two)
+      EOS
+
+      apply_manifest(pp, :expect_failures => true)
+    end
+    it 'validates multiple string maxes of incorrect length' do
+      pp = <<-EOS
+      $one = ['discombobulate', 'moo']
+      $two = 3
+      validate_slength($one,$two)
+      EOS
+
+      apply_manifest(pp, :expect_failures => true)
+    end
+    it 'validates multiple strings min/maxes of incorrect length' do
+      pp = <<-EOS
+      $one = ['discombobulate', 'moo']
+      $two = 17
+      $three = 10
+      validate_slength($one,$two,$three)
+      EOS
+
+      apply_manifest(pp, :expect_failures => true)
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+    it 'handles improper first argument type'
+    it 'handles non-strings in array of first argument'
+    it 'handles improper second argument type'
+    it 'handles improper third argument type'
+    it 'handles negative ranges'
+    it 'handles improper ranges'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/validate_string_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,36 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'validates a single argument' do
+      pp = <<-EOS
+      $one = 'string'
+      validate_string($one)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates an multiple arguments' do
+      pp = <<-EOS
+      $one = 'string'
+      $two = 'also string'
+      validate_string($one,$two)
+      EOS
+
+      apply_manifest(pp, :catch_failures => true)
+    end
+    it 'validates a non-string' do
+      {
+        %{validate_string({ 'a' => 'hash' })} => "Hash",
+        %{validate_string(['array'])}         => "Array",
+        %{validate_string(false)}             => "FalseClass",
+      }.each do |pp,type|
+        expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/values_at_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,73 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'values_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'returns a specific value' do
+      pp = <<-EOS
+      $one = ['a','b','c','d','e']
+      $two = 1
+      $output = values_at($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b"\]/)
+    end
+    it 'returns a specific negative index value' do
+      pending("negative numbers don't work")
+      pp = <<-EOS
+      $one = ['a','b','c','d','e']
+      $two = -1
+      $output = values_at($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["e"\]/)
+    end
+    it 'returns a range of values' do
+      pp = <<-EOS
+      $one = ['a','b','c','d','e']
+      $two = "1-3"
+      $output = values_at($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b", "c", "d"\]/)
+    end
+    it 'returns a negative specific value and range of values' do
+      pp = <<-EOS
+      $one = ['a','b','c','d','e']
+      $two = ["1-3",0]
+      $output = values_at($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["b", "c", "d", "a"\]/)
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments' do
+      pp = <<-EOS
+      $one = ['a','b','c','d','e']
+      $output = values_at($one)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Wrong number of arguments/)
+    end
+    it 'handles non-indicies arguments' do
+      pp = <<-EOS
+      $one = ['a','b','c','d','e']
+      $two = []
+      $output = values_at($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/at least one positive index/)
+    end
+
+    it 'detects index ranges smaller than the start range'
+    it 'handles index ranges larger than array'
+    it 'handles non-integer indicies'
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,35 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'returns an array of values' do
+      pp = <<-EOS
+      $arg = {
+        'a' => 1,
+        'b' => 2,
+        'c' => 3,
+      }
+      $output = values($arg)
+      notice(inline_template('<%= @output.sort.inspect %>'))
+      EOS
+      if is_future_parser_enabled?
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 2, 3\]/)
+      else
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "2", "3"\]/)
+      end
+
+    end
+  end
+  describe 'failure' do
+    it 'handles non-hash arguments' do
+      pp = <<-EOS
+      $arg = "foo"
+      $output = values($arg)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Requires hash/)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/acceptance/zip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,86 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+require 'puppet'
+
+describe 'zip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'zips two arrays of numbers together' do
+      pp = <<-EOS
+      $one = [1,2,3,4]
+      $two = [5,6,7,8]
+      $output = zip($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+      if is_future_parser_enabled?
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\], \[3, 7\], \[4, 8\]\]/)
+      else
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\], \["3", "7"\], \["4", "8"\]\]/)
+      end
+    end
+    it 'zips two arrays of numbers & bools together' do
+      pp = <<-EOS
+      $one = [1,2,"three",4]
+      $two = [true,true,false,false]
+      $output = zip($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+      if is_future_parser_enabled?
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, true\], \[2, true\], \["three", false\], \[4, false\]\]/)
+      else
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", true\], \["2", true\], \["three", false\], \["4", false\]\]/)
+      end
+    end
+    it 'zips two arrays of numbers together and flattens them' do
+      # XXX This only tests the argument `true`, even though the following are valid:
+      # 1 t y true yes
+      # 0 f n false no
+      # undef undefined
+      pp = <<-EOS
+      $one = [1,2,3,4]
+      $two = [5,6,7,8]
+      $output = zip($one,$two,true)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+      if is_future_parser_enabled?
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 5, 2, 6, 3, 7, 4, 8\]/)
+      else
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "5", "2", "6", "3", "7", "4", "8"\]/)
+      end
+    end
+    it 'handles unmatched length' do
+      # XXX Is this expected behavior?
+      pp = <<-EOS
+      $one = [1,2]
+      $two = [5,6,7,8]
+      $output = zip($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+      if is_future_parser_enabled?
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\]\]/)
+      else
+        expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'handles improper number of arguments' do
+      pp = <<-EOS
+      $one = [1,2]
+      $output = zip($one)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Wrong number of arguments/)
+    end
+    it 'handles improper argument types' do
+      pp = <<-EOS
+      $one = "a string"
+      $two = [5,6,7,8]
+      $output = zip($one,$two)
+      notice(inline_template('<%= @output.inspect %>'))
+      EOS
+
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Requires array/)
+    end
+  end
+end
--- a/modules/stdlib/spec/classes/anchor_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/classes/anchor_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,31 +1,29 @@
-require 'puppet'
-require 'rspec-puppet'
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+require 'puppet_spec/compiler'
 
 describe "anchorrefresh" do
-  let(:node) { 'testhost.example.com' }
-  let :pre_condition do
-    <<-ANCHORCLASS
-class anchored {
-  anchor { 'anchored::begin': }
-  ~> anchor { 'anchored::end': }
-}
+  include PuppetSpec::Compiler
 
-class anchorrefresh {
-  notify { 'first': }
-  ~> class { 'anchored': }
-  ~> anchor { 'final': }
-}
+  let :transaction do
+    apply_compiled_manifest(<<-ANCHORCLASS)
+      class anchored {
+        anchor { 'anchored::begin': }
+        ~> anchor { 'anchored::end': }
+      }
+
+      class anchorrefresh {
+        notify { 'first': }
+        ~> class { 'anchored': }
+        ~> anchor { 'final': }
+      }
+
+      include anchorrefresh
     ANCHORCLASS
   end
 
-  def apply_catalog_and_return_exec_rsrc
-    catalog = subject.to_ral
-    transaction = catalog.apply
-    transaction.resource_status("Anchor[final]")
-  end
-
   it 'propagates events through the anchored class' do
-    resource = apply_catalog_and_return_exec_rsrc
+    resource = transaction.resource_status('Anchor[final]')
 
     expect(resource.restarted).to eq(true)
   end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/abs_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,25 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the abs function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("abs")).to eq("function_abs")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_abs([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert a negative number into a positive" do
+    result = scope.function_abs(["-34"])
+    expect(result).to(eq(34))
+  end
+
+  it "should do nothing with a positive number" do
+    result = scope.function_abs(["5678"])
+    expect(result).to(eq(5678))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/any2array_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,55 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the any2array function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("any2array")).to eq("function_any2array")
+  end
+
+  it "should return an empty array if there is less than 1 argument" do
+    result = scope.function_any2array([])
+    expect(result).to(eq([]))
+  end
+
+  it "should convert boolean true to [ true ] " do
+    result = scope.function_any2array([true])
+    expect(result).to(eq([true]))
+  end
+
+  it "should convert one object to [object]" do
+    result = scope.function_any2array(['one'])
+    expect(result).to(eq(['one']))
+  end
+
+  it "should convert multiple objects to [objects]" do
+    result = scope.function_any2array(['one', 'two'])
+    expect(result).to(eq(['one', 'two']))
+  end
+
+  it "should return empty array it was called with" do
+    result = scope.function_any2array([[]])
+    expect(result).to(eq([]))
+  end
+
+  it "should return one-member array it was called with" do
+    result = scope.function_any2array([['string']])
+    expect(result).to(eq(['string']))
+  end
+
+  it "should return multi-member array it was called with" do
+    result = scope.function_any2array([['one', 'two']])
+    expect(result).to(eq(['one', 'two']))
+  end
+
+  it "should return members of a hash it was called with" do
+    result = scope.function_any2array([{ 'key' => 'value' }])
+    expect(result).to(eq(['key', 'value']))
+  end
+
+  it "should return an empty array if it was called with an empty hash" do
+    result = scope.function_any2array([{ }])
+    expect(result).to(eq([]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/base64_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the base64 function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("base64")).to eq("function_base64")
+  end
+
+  it "should raise a ParseError if there are other than 2 arguments" do
+    expect { scope.function_base64([]) }.to(raise_error(Puppet::ParseError))
+    expect { scope.function_base64(["asdf"]) }.to(raise_error(Puppet::ParseError))
+    expect { scope.function_base64(["asdf","moo","cow"]) }.to(raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if argument 1 isn't 'encode' or 'decode'" do
+    expect { scope.function_base64(["bees","astring"]) }.to(raise_error(Puppet::ParseError, /first argument must be one of/))
+  end
+
+  it "should raise a ParseError if argument 2 isn't a string" do
+    expect { scope.function_base64(["encode",["2"]]) }.to(raise_error(Puppet::ParseError, /second argument must be a string/))
+  end
+
+  it "should encode a encoded string" do
+    result = scope.function_base64(["encode",'thestring'])
+    expect(result).to match(/\AdGhlc3RyaW5n\n\Z/)
+  end
+  it "should decode a base64 encoded string" do
+    result = scope.function_base64(["decode",'dGhlc3RyaW5n'])
+    expect(result).to eq('thestring')
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/bool2num_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,38 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the bool2num function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("bool2num")).to eq("function_bool2num")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_bool2num([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert true to 1" do
+    result = scope.function_bool2num([true])
+    expect(result).to(eq(1))
+  end
+
+  it "should convert 'true' to 1" do
+    result = scope.function_bool2num(['true'])
+    result.should(eq(1))
+  end
+
+  it "should convert 'false' to 0" do
+    result = scope.function_bool2num(['false'])
+    expect(result).to(eq(0))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('true')
+    result = scope.function_bool2num([value])
+    result.should(eq(1))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/capitalize_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the capitalize function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("capitalize")).to eq("function_capitalize")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_capitalize([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should capitalize the beginning of a string" do
+    result = scope.function_capitalize(["abc"])
+    expect(result).to(eq("Abc"))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('abc')
+    result = scope.function_capitalize([value])
+    result.should(eq('Abc'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/chomp_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the chomp function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("chomp")).to eq("function_chomp")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_chomp([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should chomp the end of a string" do
+    result = scope.function_chomp(["abc\n"])
+    expect(result).to(eq("abc"))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new("abc\n")
+    result = scope.function_chomp([value])
+    result.should(eq("abc"))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/chop_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the chop function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("chop")).to eq("function_chop")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_chop([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should chop the end of a string" do
+    result = scope.function_chop(["asdf\n"])
+    expect(result).to(eq("asdf"))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new("abc\n")
+    result = scope.function_chop([value])
+    result.should(eq('abc'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/concat_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,35 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the concat function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should raise a ParseError if the client does not provide two arguments" do
+    expect { scope.function_concat([]) }.to(raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if the first parameter is not an array" do
+    expect { scope.function_concat([1, []])}.to(raise_error(Puppet::ParseError))
+  end
+
+  it "should be able to concat an array" do
+    result = scope.function_concat([['1','2','3'],['4','5','6']])
+    expect(result).to(eq(['1','2','3','4','5','6']))
+  end
+
+  it "should be able to concat a primitive to an array" do
+    result = scope.function_concat([['1','2','3'],'4'])
+    expect(result).to(eq(['1','2','3','4']))
+  end
+
+  it "should not accidentally flatten nested arrays" do
+    result = scope.function_concat([['1','2','3'],[['4','5'],'6']])
+    expect(result).to(eq(['1','2','3',['4','5'],'6']))
+  end
+
+  it "should leave the original array intact" do
+    array_original = ['1','2','3']
+    result = scope.function_concat([array_original,['4','5','6']])
+    array_original.should(eq(['1','2','3']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/count_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the count function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("count")).to eq("function_count")
+  end
+
+  it "should raise a ArgumentError if there is more than 2 arguments" do
+    expect { scope.function_count(['foo', 'bar', 'baz']) }.to( raise_error(ArgumentError))
+  end
+
+  it "should be able to count arrays" do
+    expect(scope.function_count([["1","2","3"]])).to(eq(3))
+  end
+
+  it "should be able to count matching elements in arrays" do
+    expect(scope.function_count([["1", "2", "2"], "2"])).to(eq(2))
+  end
+
+  it "should not count nil or empty strings" do
+    expect(scope.function_count([["foo","bar",nil,""]])).to(eq(2))
+  end
+
+  it 'does not count an undefined hash key or an out of bound array index (which are both :undef)' do
+    expect(scope.function_count([["foo",:undef,:undef]])).to eq(1)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/deep_merge_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,105 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:deep_merge) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe 'when calling deep_merge from puppet' do
+    it "should not compile when no arguments are passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = '$x = deep_merge()'
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should not compile when 1 argument is passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = "$my_hash={'one' => 1}\n$x = deep_merge($my_hash)"
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+  end
+
+  describe 'when calling deep_merge on the scope instance' do
+    it 'should require all parameters are hashes' do
+      expect { new_hash = scope.function_deep_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/)
+      expect { new_hash = scope.function_deep_merge([{}, 2])}.to raise_error(Puppet::ParseError, /unexpected argument type Fixnum/)
+    end
+
+    it 'should accept empty strings as puppet undef' do
+      expect { new_hash = scope.function_deep_merge([{}, ''])}.not_to raise_error
+    end
+
+    it 'should be able to deep_merge two hashes' do
+      new_hash = scope.function_deep_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])
+      expect(new_hash['one']).to   eq('1')
+      expect(new_hash['two']).to   eq('2')
+      expect(new_hash['three']).to eq('2')
+    end
+
+    it 'should deep_merge multiple hashes' do
+      hash = scope.function_deep_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}])
+      expect(hash['one']).to eq('3')
+    end
+
+    it 'should accept empty hashes' do
+      expect(scope.function_deep_merge([{},{},{}])).to eq({})
+    end
+
+    it 'should deep_merge subhashes' do
+      hash = scope.function_deep_merge([{'one' => 1}, {'two' => 2, 'three' => { 'four' => 4 } }])
+      expect(hash['one']).to eq(1)
+      expect(hash['two']).to eq(2)
+      expect(hash['three']).to eq({ 'four' => 4 })
+    end
+
+    it 'should append to subhashes' do
+      hash = scope.function_deep_merge([{'one' => { 'two' => 2 } }, { 'one' => { 'three' => 3 } }])
+      expect(hash['one']).to eq({ 'two' => 2, 'three' => 3 })
+    end
+
+    it 'should append to subhashes 2' do
+      hash = scope.function_deep_merge([{'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }, {'two' => 'dos', 'three' => { 'five' => 5 } }])
+      expect(hash['one']).to eq(1)
+      expect(hash['two']).to eq('dos')
+      expect(hash['three']).to eq({ 'four' => 4, 'five' => 5 })
+    end
+
+    it 'should append to subhashes 3' do
+      hash = scope.function_deep_merge([{ 'key1' => { 'a' => 1, 'b' => 2 }, 'key2' => { 'c' => 3 } }, { 'key1' => { 'b' => 99 } }])
+      expect(hash['key1']).to eq({ 'a' => 1, 'b' => 99 })
+      expect(hash['key2']).to eq({ 'c' => 3 })
+    end
+
+    it 'should not change the original hashes' do
+      hash1 = {'one' => { 'two' => 2 } }
+      hash2 = { 'one' => { 'three' => 3 } }
+      hash = scope.function_deep_merge([hash1, hash2])
+      expect(hash1).to eq({'one' => { 'two' => 2 } })
+      expect(hash2).to eq({ 'one' => { 'three' => 3 } })
+      expect(hash['one']).to eq({ 'two' => 2, 'three' => 3 })
+    end
+
+    it 'should not change the original hashes 2' do
+      hash1 = {'one' => { 'two' => [1,2] } }
+      hash2 = { 'one' => { 'three' => 3 } }
+      hash = scope.function_deep_merge([hash1, hash2])
+      expect(hash1).to eq({'one' => { 'two' => [1,2] } })
+      expect(hash2).to eq({ 'one' => { 'three' => 3 } })
+      expect(hash['one']).to eq({ 'two' => [1,2], 'three' => 3 })
+    end
+
+    it 'should not change the original hashes 3' do
+      hash1 = {'one' => { 'two' => [1,2, {'two' => 2} ] } }
+      hash2 = { 'one' => { 'three' => 3 } }
+      hash = scope.function_deep_merge([hash1, hash2])
+      expect(hash1).to eq({'one' => { 'two' => [1,2, {'two' => 2}] } })
+      expect(hash2).to eq({ 'one' => { 'three' => 3 } })
+      expect(hash['one']).to eq({ 'two' => [1,2, {'two' => 2} ], 'three' => 3 })
+      expect(hash['one']['two']).to eq([1,2, {'two' => 2}])
+    end
+  end
+end
--- a/modules/stdlib/spec/functions/defined_with_params_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/functions/defined_with_params_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -4,16 +4,16 @@
 require 'rspec-puppet'
 describe 'defined_with_params' do
   describe 'when a resource is not specified' do
-    it { should run.with_params().and_raise_error(ArgumentError) }
+    it { is_expected.to run.with_params().and_raise_error(ArgumentError) }
   end
   describe 'when compared against a resource with no attributes' do
     let :pre_condition do
       'user { "dan": }'
     end
     it do
-      should run.with_params('User[dan]', {}).and_return(true)
-      should run.with_params('User[bob]', {}).and_return(false)
-      should run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false)
+      is_expected.to run.with_params('User[dan]', {}).and_return(true)
+      is_expected.to run.with_params('User[bob]', {}).and_return(false)
+      is_expected.to run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false)
     end
   end
 
@@ -22,14 +22,14 @@
       'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}'
     end
     it do
-      should run.with_params('User[dan]', {}).and_return(true)
-      should run.with_params('User[dan]', '').and_return(true)
-      should run.with_params('User[dan]', {'ensure' => 'present'}
+      is_expected.to run.with_params('User[dan]', {}).and_return(true)
+      is_expected.to run.with_params('User[dan]', '').and_return(true)
+      is_expected.to run.with_params('User[dan]', {'ensure' => 'present'}
                             ).and_return(true)
-      should run.with_params('User[dan]',
+      is_expected.to run.with_params('User[dan]',
                              {'ensure' => 'present', 'managehome' => false}
                             ).and_return(true)
-      should run.with_params('User[dan]',
+      is_expected.to run.with_params('User[dan]',
                              {'ensure' => 'absent', 'managehome' => false}
                             ).and_return(false)
     end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/delete_at_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,25 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the delete_at function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("delete_at")).to eq("function_delete_at")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_delete_at([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should delete an item at specified location from an array" do
+    result = scope.function_delete_at([['a','b','c'],1])
+    expect(result).to(eq(['a','c']))
+  end
+
+  it "should not change origin array passed as argument" do
+    origin_array = ['a','b','c','d']
+    result = scope.function_delete_at([origin_array, 1])
+    expect(origin_array).to(eq(['a','b','c','d']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/delete_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,56 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the delete function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("delete")).to eq("function_delete")
+  end
+
+  it "should raise a ParseError if there are fewer than 2 arguments" do
+    expect { scope.function_delete([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if there are greater than 2 arguments" do
+    expect { scope.function_delete([[], 'foo', 'bar']) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a TypeError if a number is passed as the first argument" do
+    expect { scope.function_delete([1, 'bar']) }.to( raise_error(TypeError))
+  end
+
+  it "should delete all instances of an element from an array" do
+    result = scope.function_delete([['a','b','c','b'],'b'])
+    expect(result).to(eq(['a','c']))
+  end
+
+  it "should delete all instances of a substring from a string" do
+    result = scope.function_delete(['foobarbabarz','bar'])
+    expect(result).to(eq('foobaz'))
+  end
+
+  it "should delete a key from a hash" do
+    result = scope.function_delete([{ 'a' => 1, 'b' => 2, 'c' => 3 },'b'])
+    expect(result).to(eq({ 'a' => 1, 'c' => 3 }))
+  end
+
+  it "should not change origin array passed as argument" do
+    origin_array = ['a','b','c','d']
+    result = scope.function_delete([origin_array, 'b'])
+    expect(origin_array).to(eq(['a','b','c','d']))
+  end
+
+  it "should not change the origin string passed as argument" do
+    origin_string = 'foobarbabarz'
+    result = scope.function_delete([origin_string,'bar'])
+    expect(origin_string).to(eq('foobarbabarz'))
+  end
+
+  it "should not change origin hash passed as argument" do
+    origin_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }
+    result = scope.function_delete([origin_hash, 'b'])
+    expect(origin_hash).to(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
+  end
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/delete_undef_values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,41 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the delete_undef_values function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("delete_undef_values")).to eq("function_delete_undef_values")
+  end
+
+  it "should raise a ParseError if there is less than 1 argument" do
+    expect { scope.function_delete_undef_values([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if the argument is not Array nor Hash" do
+    expect { scope.function_delete_undef_values(['']) }.to( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_undef_values([nil]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should delete all undef items from Array and only these" do
+    result = scope.function_delete_undef_values([['a',:undef,'c','undef']])
+    expect(result).to(eq(['a','c','undef']))
+  end
+
+  it "should delete all undef items from Hash and only these" do
+    result = scope.function_delete_undef_values([{'a'=>'A','b'=>:undef,'c'=>'C','d'=>'undef'}])
+    expect(result).to(eq({'a'=>'A','c'=>'C','d'=>'undef'}))
+  end
+
+  it "should not change origin array passed as argument" do
+    origin_array = ['a',:undef,'c','undef']
+    result = scope.function_delete_undef_values([origin_array])
+    expect(origin_array).to(eq(['a',:undef,'c','undef']))
+  end
+
+  it "should not change origin hash passed as argument" do
+    origin_hash = { 'a' => 1, 'b' => :undef, 'c' => 'undef' }
+    result = scope.function_delete_undef_values([origin_hash])
+    expect(origin_hash).to(eq({ 'a' => 1, 'b' => :undef, 'c' => 'undef' }))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/delete_values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,36 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the delete_values function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("delete_values")).to eq("function_delete_values")
+  end
+
+  it "should raise a ParseError if there are fewer than 2 arguments" do
+    expect { scope.function_delete_values([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if there are greater than 2 arguments" do
+    expect { scope.function_delete_values([[], 'foo', 'bar']) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a TypeError if the argument is not a hash" do
+    expect { scope.function_delete_values([1,'bar']) }.to( raise_error(TypeError))
+    expect { scope.function_delete_values(['foo','bar']) }.to( raise_error(TypeError))
+    expect { scope.function_delete_values([[],'bar']) }.to( raise_error(TypeError))
+  end
+
+  it "should delete all instances of a value from a hash" do
+    result = scope.function_delete_values([{ 'a'=>'A', 'b'=>'B', 'B'=>'C', 'd'=>'B' },'B'])
+    expect(result).to(eq({ 'a'=>'A', 'B'=>'C' }))
+  end
+
+  it "should not change origin hash passed as argument" do
+    origin_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }
+    result = scope.function_delete_values([origin_hash, 2])
+    expect(origin_hash).to(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
+  end
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/difference_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the difference function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("difference")).to eq("function_difference")
+  end
+
+  it "should raise a ParseError if there are fewer than 2 arguments" do
+    expect { scope.function_difference([]) }.to( raise_error(Puppet::ParseError) )
+  end
+
+  it "should return the difference between two arrays" do
+    result = scope.function_difference([["a","b","c"],["b","c","d"]])
+    expect(result).to(eq(["a"]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/dirname_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the dirname function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("dirname")).to eq("function_dirname")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_dirname([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return dirname for an absolute path" do
+    result = scope.function_dirname(['/path/to/a/file.ext'])
+    expect(result).to(eq('/path/to/a'))
+  end
+
+  it "should return dirname for a relative path" do
+    result = scope.function_dirname(['path/to/a/file.ext'])
+    expect(result).to(eq('path/to/a'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/downcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the downcase function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("downcase")).to eq("function_downcase")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_downcase([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should downcase a string" do
+    result = scope.function_downcase(["ASFD"])
+    expect(result).to(eq("asfd"))
+  end
+
+  it "should do nothing to a string that is already downcase" do
+    result = scope.function_downcase(["asdf asdf"])
+    expect(result).to(eq("asdf asdf"))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new("ASFD")
+    result = scope.function_downcase([value])
+    result.should(eq('asfd'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/empty_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,32 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the empty function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("empty")).to eq("function_empty")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_empty([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return a true for an empty string" do
+    result = scope.function_empty([''])
+    expect(result).to(eq(true))
+  end
+
+  it "should return a false for a non-empty string" do
+    result = scope.function_empty(['asdf'])
+    expect(result).to(eq(false))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new()
+    result = scope.function_empty([value])
+    result.should(eq(true))
+  end
+end
--- a/modules/stdlib/spec/functions/ensure_packages_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/functions/ensure_packages_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -2,41 +2,80 @@
 
 require 'spec_helper'
 require 'rspec-puppet'
+require 'puppet_spec/compiler'
 
 describe 'ensure_packages' do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  include PuppetSpec::Compiler
+
+  before :each do
+    Puppet::Parser::Functions.autoloader.loadall
+    Puppet::Parser::Functions.function(:ensure_packages)
+    Puppet::Parser::Functions.function(:ensure_resource)
+    Puppet::Parser::Functions.function(:defined_with_params)
+    Puppet::Parser::Functions.function(:create_resources)
+  end
+
+  let :node     do Puppet::Node.new('localhost') end
+  let :compiler do Puppet::Parser::Compiler.new(node) end
+  let :scope    do
+    if Puppet.version.to_f >= 3.0
+      Puppet::Parser::Scope.new(compiler)
+    else
+      newscope = Puppet::Parser::Scope.new
+      newscope.compiler = compiler
+      newscope.source   = Puppet::Resource::Type.new(:node, :localhost)
+      newscope
+    end
+  end
 
   describe 'argument handling' do
     it 'fails with no arguments' do
-      should run.with_params().and_raise_error(Puppet::ParseError)
+      expect {
+        scope.function_ensure_packages([])
+      }.to raise_error(Puppet::ParseError, /0 for 1 or 2/)
     end
-    it 'requires an array' do
-      lambda { scope.function_ensure_packages([['foo']]) }.should_not raise_error
+
+    it 'accepts an array of values' do
+      scope.function_ensure_packages([['foo']])
     end
-    it 'fails when given a string' do
-      should run.with_params('foo').and_raise_error(Puppet::ParseError)
+
+    it 'accepts a single package name as a string' do
+      scope.function_ensure_packages(['foo'])
     end
   end
 
-  context 'given a catalog containing Package[puppet]{ensure => absent}' do
-    let :pre_condition do
-      'package { puppet: ensure => absent }'
+  context 'given a catalog with puppet package => absent' do
+    let :catalog do
+      compile_to_catalog(<<-EOS
+        ensure_packages(['facter'])
+        package { puppet: ensure => absent }
+      EOS
+      )
     end
 
-    # NOTE: should run.with_params has the side effect of making the compiler
-    # available to the test harness.
     it 'has no effect on Package[puppet]' do
-      should run.with_params(['puppet'])
-      rsrc = compiler.catalog.resource('Package[puppet]')
-      rsrc.to_hash.should == {:ensure => "absent"}
+      expect(catalog.resource(:package, 'puppet')['ensure']).to eq('absent')
     end
   end
 
   context 'given a clean catalog' do
+    let :catalog do
+      compile_to_catalog('ensure_packages(["facter"])')
+    end
+
     it 'declares package resources with ensure => present' do
-      should run.with_params(['facter'])
-      rsrc = compiler.catalog.resource('Package[facter]')
-      rsrc.to_hash.should == {:name => "facter", :ensure => "present"}
+      expect(catalog.resource(:package, 'facter')['ensure']).to eq('present')
+    end
+  end
+
+  context 'given a clean catalog and specified defaults' do
+    let :catalog do
+      compile_to_catalog('ensure_packages(["facter"], {"provider" => "gem"})')
+    end
+
+    it 'declares package resources with ensure => present' do
+      expect(catalog.resource(:package, 'facter')['ensure']).to eq('present')
+      expect(catalog.resource(:package, 'facter')['provider']).to eq('gem')
     end
   end
 end
--- a/modules/stdlib/spec/functions/ensure_resource_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/functions/ensure_resource_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,64 +1,113 @@
 #! /usr/bin/env ruby -S rspec
 require 'spec_helper'
+require 'rspec-puppet'
+require 'puppet_spec/compiler'
 
-require 'rspec-puppet'
 describe 'ensure_resource' do
+  include PuppetSpec::Compiler
+
+  before :all do
+    Puppet::Parser::Functions.autoloader.loadall
+    Puppet::Parser::Functions.function(:ensure_packages)
+  end
+
+  let :node     do Puppet::Node.new('localhost') end
+  let :compiler do Puppet::Parser::Compiler.new(node) end
+  let :scope    do Puppet::Parser::Scope.new(compiler) end
+
   describe 'when a type or title is not specified' do
-    it { should run.with_params().and_raise_error(ArgumentError) }
-    it { should run.with_params(['type']).and_raise_error(ArgumentError) }
+    it { expect { scope.function_ensure_resource([]) }.to raise_error }
+    it { expect { scope.function_ensure_resource(['type']) }.to raise_error }
   end
 
   describe 'when compared against a resource with no attributes' do
-    let :pre_condition do
-      'user { "dan": }'
+    let :catalog do
+      compile_to_catalog(<<-EOS
+        user { "dan": }
+        ensure_resource('user', 'dan', {})
+      EOS
+      )
     end
-    it "should contain the the ensured resources" do
-      subject.should run.with_params('user', 'dan', {})
-      compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]'
+
+    it 'should contain the the ensured resources' do
+      expect(catalog.resource(:user, 'dan').to_s).to eq('User[dan]')
     end
   end
 
-  describe 'when compared against a resource with attributes' do
-    let :pre_condition do
-      'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}'
+  describe 'works when compared against a resource with non-conflicting attributes' do
+    [
+      "ensure_resource('User', 'dan', {})",
+      "ensure_resource('User', 'dan', '')",
+      "ensure_resource('User', 'dan', {'ensure' => 'present'})",
+      "ensure_resource('User', 'dan', {'ensure' => 'present', 'managehome' => false})"
+    ].each do |ensure_resource|
+      pp = <<-EOS
+        user { "dan": ensure => present, shell => "/bin/csh", managehome => false}
+        #{ensure_resource}
+      EOS
+
+      it { expect { compile_to_catalog(pp) }.to_not raise_error }
     end
-    # these first three should not fail
-    it { should run.with_params('User', 'dan', {}) }
-    it { should run.with_params('User', 'dan', '') }
-    it { should run.with_params('User', 'dan', {'ensure' => 'present'}) }
-    it { should run.with_params('User', 'dan', {'ensure' => 'present', 'managehome' => false}) }
-    #  test that this fails
-    it { should run.with_params('User', 'dan', {'ensure' => 'absent', 'managehome' => false}).and_raise_error(Puppet::Error) }
+  end
+
+  describe 'fails when compared against a resource with conflicting attributes' do
+    pp = <<-EOS
+      user { "dan": ensure => present, shell => "/bin/csh", managehome => false}
+      ensure_resource('User', 'dan', {'ensure' => 'absent', 'managehome' => false})
+    EOS
+
+    it { expect { compile_to_catalog(pp) }.to raise_error }
   end
 
   describe 'when an array of new resources are passed in' do
-    it "should contain the ensured resources" do
-      subject.should run.with_params('User', ['dan', 'alex'], {})
-      compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]'
-      compiler.catalog.resource('User[alex]').to_s.should == 'User[alex]'
+    let :catalog do
+      compile_to_catalog("ensure_resource('User', ['dan', 'alex'], {})")
+    end
+
+    it 'should contain the ensured resources' do
+      expect(catalog.resource('User[dan]').to_s).to eq('User[dan]')
+      expect(catalog.resource('User[alex]').to_s).to eq('User[alex]')
     end
   end
 
   describe 'when an array of existing resources is compared against existing resources' do
-    let :pre_condition do
-      'user { "dan": ensure => present; "alex": ensure => present }'
+    pp = <<-EOS
+      user { 'dan': ensure => present; 'alex': ensure => present }
+      ensure_resource('User', ['dan', 'alex'], {})
+    EOS
+
+    let :catalog do
+      compile_to_catalog(pp)
     end
-    it "should return the existing resources" do
-      subject.should run.with_params('User', ['dan', 'alex'], {})
-      compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]'
-      compiler.catalog.resource('User[alex]').to_s.should == 'User[alex]'
+
+    it 'should return the existing resources' do
+      expect(catalog.resource('User[dan]').to_s).to eq('User[dan]')
+      expect(catalog.resource('User[alex]').to_s).to eq('User[alex]')
     end
   end
 
-  describe 'when compared against existing resources with attributes' do
-    let :pre_condition do
-      'user { "dan": ensure => present; "alex": ensure => present }'
+  describe 'works when compared against existing resources with attributes' do
+    [
+      "ensure_resource('User', ['dan', 'alex'], {})",
+      "ensure_resource('User', ['dan', 'alex'], '')",
+      "ensure_resource('User', ['dan', 'alex'], {'ensure' => 'present'})",
+    ].each do |ensure_resource|
+      pp = <<-EOS
+        user { 'dan': ensure => present; 'alex': ensure => present }
+        #{ensure_resource}
+      EOS
+
+      it { expect { compile_to_catalog(pp) }.to_not raise_error }
     end
-    # These should not fail
-    it { should run.with_params('User', ['dan', 'alex'], {}) }
-    it { should run.with_params('User', ['dan', 'alex'], '') }
-    it { should run.with_params('User', ['dan', 'alex'], {'ensure' => 'present'}) }
-    # This should fail
-    it { should run.with_params('User', ['dan', 'alex'], {'ensure' => 'absent'}).and_raise_error(Puppet::Error) }
   end
+
+  describe 'fails when compared against existing resources with conflicting attributes' do
+    pp = <<-EOS
+      user { 'dan': ensure => present; 'alex': ensure => present }
+      ensure_resource('User', ['dan', 'alex'], {'ensure' => 'absent'})
+    EOS
+
+    it { expect { compile_to_catalog(pp) }.to raise_error }
+  end
+
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/flatten_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the flatten function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("flatten")).to eq("function_flatten")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_flatten([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if there is more than 1 argument" do
+    expect { scope.function_flatten([[], []]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should flatten a complex data structure" do
+    result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]])
+    expect(result).to(eq(["a","b","c","d","e","f","g"]))
+  end
+
+  it "should do nothing to a structure that is already flat" do
+    result = scope.function_flatten([["a","b","c","d"]])
+    expect(result).to(eq(["a","b","c","d"]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/floor_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the floor function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("floor")).to eq("function_floor")
+  end
+
+  it "should raise a ParseError if there is less than 1 argument" do
+    expect { scope.function_floor([]) }.to( raise_error(Puppet::ParseError, /Wrong number of arguments/))
+  end
+
+  it "should should raise a ParseError if input isn't numeric (eg. String)" do
+    expect { scope.function_floor(["foo"]) }.to( raise_error(Puppet::ParseError, /Wrong argument type/))
+  end
+
+  it "should should raise a ParseError if input isn't numeric (eg. Boolean)" do
+    expect { scope.function_floor([true]) }.to( raise_error(Puppet::ParseError, /Wrong argument type/))
+  end
+
+  it "should return an integer when a numeric type is passed" do
+    result = scope.function_floor([12.4])
+    expect(result.is_a?(Integer)).to(eq(true))
+  end
+
+  it "should return the input when an integer is passed" do
+    result = scope.function_floor([7])
+    expect(result).to(eq(7))
+  end
+
+  it "should return the largest integer less than or equal to the input" do
+    result = scope.function_floor([3.8])
+    expect(result).to(eq(3))
+  end
+end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/fqdn_rotate_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,43 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the fqdn_rotate function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("fqdn_rotate")).to eq("function_fqdn_rotate")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_fqdn_rotate([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should rotate a string and the result should be the same size" do
+    scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
+    result = scope.function_fqdn_rotate(["asdf"])
+    expect(result.size).to(eq(4))
+  end
+
+  it "should rotate a string to give the same results for one host" do
+    scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1").twice
+    expect(scope.function_fqdn_rotate(["abcdefg"])).to eql(scope.function_fqdn_rotate(["abcdefg"]))
+  end
+
+  it "should rotate a string to give different values on different hosts" do
+     scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
+     val1 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
+     scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.2")
+     val2 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
+     expect(val1).not_to eql(val2)
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
+    value = AlsoString.new("asdf")
+    result = scope.function_fqdn_rotate([value])
+    result.size.should(eq(4))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/get_module_path_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,46 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:get_module_path) do
+  Internals = PuppetlabsSpec::PuppetInternals
+  class StubModule
+    attr_reader :path
+    def initialize(path)
+      @path = path
+    end
+  end
+
+  def scope(environment = "production")
+    Internals.scope(:compiler => Internals.compiler(:node => Internals.node(:environment => environment)))
+  end
+
+  it 'should only allow one argument' do
+    expect { scope.function_get_module_path([]) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
+    expect { scope.function_get_module_path(['1','2','3']) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
+  end
+  it 'should raise an exception when the module cannot be found' do
+    expect { scope.function_get_module_path(['foo']) }.to raise_error(Puppet::ParseError, /Could not find module/)
+  end
+  describe 'when locating a module' do
+    let(:modulepath) { "/tmp/does_not_exist" }
+    let(:path_of_module_foo) { StubModule.new("/tmp/does_not_exist/foo") }
+
+    before(:each) { Puppet[:modulepath] = modulepath }
+
+    it 'should be able to find module paths from the modulepath setting' do
+      Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo)
+      expect(scope.function_get_module_path(['foo'])).to eq(path_of_module_foo.path)
+    end
+    it 'should be able to find module paths when the modulepath is a list' do
+      Puppet[:modulepath] = modulepath + ":/tmp"
+      Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo)
+      expect(scope.function_get_module_path(['foo'])).to eq(path_of_module_foo.path)
+    end
+    it 'should respect the environment' do
+      skip("Disabled on Puppet 2.6.x") if Puppet.version =~ /^2\.6\b/
+      Puppet.settings[:environment] = 'danstestenv'
+      Puppet::Module.expects(:find).with('foo', 'danstestenv').returns(path_of_module_foo)
+      expect(scope('danstestenv').function_get_module_path(['foo'])).to eq(path_of_module_foo.path)
+    end
+  end
+end
--- a/modules/stdlib/spec/functions/getparam_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/functions/getparam_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,34 +1,76 @@
 #! /usr/bin/env ruby -S rspec
 require 'spec_helper'
+require 'rspec-puppet'
+require 'puppet_spec/compiler'
 
-require 'rspec-puppet'
 describe 'getparam' do
-  describe 'when a resource is not specified' do
-    it do
-      should run.with_params().and_raise_error(ArgumentError)
-      should run.with_params('User[dan]').and_raise_error(ArgumentError)
-      should run.with_params('User[dan]', {}).and_raise_error(ArgumentError)
-      should run.with_params('User[dan]', '').and_return('')
+  include PuppetSpec::Compiler
+
+  before :each do
+    Puppet::Parser::Functions.autoloader.loadall
+    Puppet::Parser::Functions.function(:getparam)
+  end
+
+  let :node     do Puppet::Node.new('localhost') end
+  let :compiler do Puppet::Parser::Compiler.new(node) end
+  if Puppet.version.to_f >= 3.0
+    let :scope    do Puppet::Parser::Scope.new(compiler) end
+  else
+    let :scope    do
+      newscope = Puppet::Parser::Scope.new
+      newscope.compiler = compiler
+      newscope.source   = Puppet::Resource::Type.new(:node, :localhost)
+      newscope
     end
   end
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("getparam")).to eq("function_getparam")
+  end
+
+  describe 'when a resource is not specified' do
+    it { expect { scope.function_getparam([]) }.to raise_error }
+    it { expect { scope.function_getparam(['User[dan]']) }.to raise_error }
+    it { expect { scope.function_getparam(['User[dan]']) }.to raise_error }
+    it { expect { scope.function_getparam(['User[dan]', {}]) }.to raise_error }
+    # This seems to be OK because we just check for a string.
+    it { expect { scope.function_getparam(['User[dan]', '']) }.to_not raise_error }
+  end
+
   describe 'when compared against a resource with no params' do
-    let :pre_condition do
-      'user { "dan": }'
+    let :catalog do
+      compile_to_catalog(<<-EOS
+        user { "dan": }
+      EOS
+      )
     end
+
     it do
-      should run.with_params('User[dan]', 'shell').and_return('')
+      expect(scope.function_getparam(['User[dan]', 'shell'])).to eq('')
     end
   end
 
   describe 'when compared against a resource with params' do
-    let :pre_condition do
-      'user { "dan": ensure => present, shell => "/bin/sh", managehome => false}'
+    let :catalog do
+      compile_to_catalog(<<-EOS
+        user { 'dan': ensure => present, shell => '/bin/sh', managehome => false}
+        $test = getparam(User[dan], 'shell')
+      EOS
+      )
     end
+
     it do
-      should run.with_params('User[dan]', 'shell').and_return('/bin/sh')
-      should run.with_params('User[dan]', '').and_return('')
-      should run.with_params('User[dan]', 'ensure').and_return('present')
-      should run.with_params('User[dan]', 'managehome').and_return(false)
+      resource = Puppet::Parser::Resource.new(:user, 'dan', {:scope => scope})
+      resource.set_parameter('ensure', 'present')
+      resource.set_parameter('shell', '/bin/sh')
+      resource.set_parameter('managehome', false)
+      compiler.add_resource(scope, resource)
+
+      expect(scope.function_getparam(['User[dan]', 'shell'])).to eq('/bin/sh')
+      expect(scope.function_getparam(['User[dan]', ''])).to eq('')
+      expect(scope.function_getparam(['User[dan]', 'ensure'])).to eq('present')
+      # TODO: Expected this to be false, figure out why we're getting '' back.
+      expect(scope.function_getparam(['User[dan]', 'managehome'])).to eq('')
     end
   end
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/getvar_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:getvar) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  describe 'when calling getvar from puppet' do
+
+    it "should not compile when no arguments are passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = '$foo = getvar()'
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should not compile when too many arguments are passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = '$foo = getvar("foo::bar", "baz")'
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should lookup variables in other namespaces" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        class site::data { $foo = 'baz' }
+        include site::data
+        $foo = getvar("site::data::foo")
+        if $foo != 'baz' {
+          fail('getvar did not return what we expect')
+        }
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/grep_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the grep function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("grep")).to eq("function_grep")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_grep([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should grep contents from an array" do
+    result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"])
+    expect(result).to(eq(["aaabbb","bbbccc"]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/has_interface_with_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,64 @@
+#!/usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:has_interface_with) do
+
+  let(:scope) do
+    PuppetlabsSpec::PuppetInternals.scope
+  end
+
+  # The subject of these examples is the method itself.
+  subject do
+    function_name = Puppet::Parser::Functions.function(:has_interface_with)
+    scope.method(function_name)
+  end
+
+  # We need to mock out the Facts so we can specify how we expect this function
+  # to behave on different platforms.
+  context "On Mac OS X Systems" do
+    before :each do
+      scope.stubs(:lookupvar).with("interfaces").returns('lo0,gif0,stf0,en1,p2p0,fw0,en0,vmnet1,vmnet8,utun0')
+    end
+    it 'should have loopback (lo0)' do
+      expect(subject.call(['lo0'])).to be_truthy
+    end
+    it 'should not have loopback (lo)' do
+      expect(subject.call(['lo'])).to be_falsey
+    end
+  end
+  context "On Linux Systems" do
+    before :each do
+      scope.stubs(:lookupvar).with("interfaces").returns('eth0,lo')
+      scope.stubs(:lookupvar).with("ipaddress").returns('10.0.0.1')
+      scope.stubs(:lookupvar).with("ipaddress_lo").returns('127.0.0.1')
+      scope.stubs(:lookupvar).with("ipaddress_eth0").returns('10.0.0.1')
+      scope.stubs(:lookupvar).with('muppet').returns('kermit')
+      scope.stubs(:lookupvar).with('muppet_lo').returns('mspiggy')
+      scope.stubs(:lookupvar).with('muppet_eth0').returns('kermit')
+    end
+    it 'should have loopback (lo)' do
+      expect(subject.call(['lo'])).to be_truthy
+    end
+    it 'should not have loopback (lo0)' do
+      expect(subject.call(['lo0'])).to be_falsey
+    end
+    it 'should have ipaddress with 127.0.0.1' do
+      expect(subject.call(['ipaddress', '127.0.0.1'])).to be_truthy
+    end
+    it 'should have ipaddress with 10.0.0.1' do
+      expect(subject.call(['ipaddress', '10.0.0.1'])).to be_truthy
+    end
+    it 'should not have ipaddress with 10.0.0.2' do
+      expect(subject.call(['ipaddress', '10.0.0.2'])).to be_falsey
+    end
+    it 'should have muppet named kermit' do
+      expect(subject.call(['muppet', 'kermit'])).to be_truthy
+    end
+    it 'should have muppet named mspiggy' do
+      expect(subject.call(['muppet', 'mspiggy'])).to be_truthy
+    end
+    it 'should not have muppet named bigbird' do
+      expect(subject.call(['muppet', 'bigbird'])).to be_falsey
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/has_ip_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:has_ip_address) do
+
+  let(:scope) do
+    PuppetlabsSpec::PuppetInternals.scope
+  end
+
+  subject do
+    function_name = Puppet::Parser::Functions.function(:has_ip_address)
+    scope.method(function_name)
+  end
+
+  context "On Linux Systems" do
+    before :each do
+      scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo')
+      scope.stubs(:lookupvar).with('ipaddress').returns('10.0.2.15')
+      scope.stubs(:lookupvar).with('ipaddress_eth0').returns('10.0.2.15')
+      scope.stubs(:lookupvar).with('ipaddress_lo').returns('127.0.0.1')
+    end
+
+    it 'should have primary address (10.0.2.15)' do
+      expect(subject.call(['10.0.2.15'])).to be_truthy
+    end
+
+    it 'should have lookupback address (127.0.0.1)' do
+      expect(subject.call(['127.0.0.1'])).to be_truthy
+    end
+
+    it 'should not have other address' do
+      expect(subject.call(['192.1681.1.1'])).to be_falsey
+    end
+
+    it 'should not have "mspiggy" on an interface' do
+      expect(subject.call(['mspiggy'])).to be_falsey
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/has_ip_network_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:has_ip_network) do
+
+  let(:scope) do
+    PuppetlabsSpec::PuppetInternals.scope
+  end
+
+  subject do
+    function_name = Puppet::Parser::Functions.function(:has_ip_network)
+    scope.method(function_name)
+  end
+
+  context "On Linux Systems" do
+    before :each do
+      scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo')
+      scope.stubs(:lookupvar).with('network').returns(:undefined)
+      scope.stubs(:lookupvar).with('network_eth0').returns('10.0.2.0')
+      scope.stubs(:lookupvar).with('network_lo').returns('127.0.0.1')
+    end
+
+    it 'should have primary network (10.0.2.0)' do
+      expect(subject.call(['10.0.2.0'])).to be_truthy
+    end
+
+    it 'should have loopback network (127.0.0.0)' do
+      expect(subject.call(['127.0.0.1'])).to be_truthy
+    end
+
+    it 'should not have other network' do
+      expect(subject.call(['192.168.1.0'])).to be_falsey
+    end
+  end
+end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/has_key_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,42 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:has_key) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe 'when calling has_key from puppet' do
+    it "should not compile when no arguments are passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = '$x = has_key()'
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should not compile when 1 argument is passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = "$x = has_key('foo')"
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should require the first value to be a Hash" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = "$x = has_key('foo', 'bar')"
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /expects the first argument to be a hash/)
+    end
+  end
+
+  describe 'when calling the function has_key from a scope instance' do
+    it 'should detect existing keys' do
+      expect(scope.function_has_key([{'one' => 1}, 'one'])).to be_truthy
+    end
+
+    it 'should detect existing keys' do
+      expect(scope.function_has_key([{'one' => 1}, 'two'])).to be_falsey
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/hash_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the hash function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("hash")).to eq("function_hash")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_hash([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert an array to a hash" do
+    result = scope.function_hash([['a',1,'b',2,'c',3]])
+    expect(result).to(eq({'a'=>1,'b'=>2,'c'=>3}))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/intersection_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the intersection function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("intersection")).to eq("function_intersection")
+  end
+
+  it "should raise a ParseError if there are fewer than 2 arguments" do
+    expect { scope.function_intersection([]) }.to( raise_error(Puppet::ParseError) )
+  end
+
+  it "should return the intersection of two arrays" do
+    result = scope.function_intersection([["a","b","c"],["b","c","d"]])
+    expect(result).to(eq(["b","c"]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_array_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,29 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_array function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_array")).to eq("function_is_array")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_array([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if passed an array" do
+    result = scope.function_is_array([[1,2,3]])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if passed a hash" do
+    result = scope.function_is_array([{'a'=>1}])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if passed a string" do
+    result = scope.function_is_array(["asdf"])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,44 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_bool function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_bool")).to eq("function_is_bool")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_bool([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if passed a TrueClass" do
+    result = scope.function_is_bool([true])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if passed a FalseClass" do
+    result = scope.function_is_bool([false])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if passed the string 'true'" do
+    result = scope.function_is_bool(['true'])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if passed the string 'false'" do
+    result = scope.function_is_bool(['false'])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if passed an array" do
+    result = scope.function_is_bool([["a","b"]])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if passed a hash" do
+    result = scope.function_is_bool([{"a" => "b"}])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_domain_name_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,64 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_domain_name function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_domain_name")).to eq("function_is_domain_name")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_domain_name([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if a valid short domain name" do
+    result = scope.function_is_domain_name(["x.com"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return true if the domain is ." do
+    result = scope.function_is_domain_name(["."])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return true if the domain is x.com." do
+    result = scope.function_is_domain_name(["x.com."])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return true if a valid domain name" do
+    result = scope.function_is_domain_name(["foo.bar.com"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should allow domain parts to start with numbers" do
+    result = scope.function_is_domain_name(["3foo.2bar.com"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should allow domain to end with a dot" do
+    result = scope.function_is_domain_name(["3foo.2bar.com."])
+    expect(result).to(be_truthy)
+  end
+
+  it "should allow a single part domain" do
+    result = scope.function_is_domain_name(["orange"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return false if domain parts start with hyphens" do
+    result = scope.function_is_domain_name(["-3foo.2bar.com"])
+    expect(result).to(be_falsey)
+  end
+
+  it "should return true if domain contains hyphens" do
+    result = scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return false if domain name contains spaces" do
+    result = scope.function_is_domain_name(["not valid"])
+    expect(result).to(be_falsey)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_float_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_float function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_float")).to eq("function_is_float")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_float([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if a float" do
+    result = scope.function_is_float(["0.12"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if a string" do
+    result = scope.function_is_float(["asdf"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if an integer" do
+    result = scope.function_is_float(["3"])
+    expect(result).to(eq(false))
+  end
+  it "should return true if a float is created from an arithmetical operation" do
+    result = scope.function_is_float([3.2*2])
+    expect(result).to(eq(true))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_function_available.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_function_available function" do
+  before :all do
+    Puppet::Parser::Functions.autoloader.loadall
+  end
+
+  before :each do
+    @scope = Puppet::Parser::Scope.new
+  end
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_function_available")).to eq("function_is_function_available")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { @scope.function_is_function_available([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return false if a nonexistent function is passed" do
+    result = @scope.function_is_function_available(['jeff_mccunes_left_sock'])
+    expect(result).to(eq(false))
+  end
+
+  it "should return true if an available function is passed" do
+    result = @scope.function_is_function_available(['require'])
+    expect(result).to(eq(true))
+  end
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_hash_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,29 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_hash function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_hash")).to eq("function_is_hash")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_hash([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if passed a hash" do
+    result = scope.function_is_hash([{"a"=>1,"b"=>2}])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if passed an array" do
+    result = scope.function_is_hash([["a","b"]])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if passed a string" do
+    result = scope.function_is_hash(["asdf"])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_integer_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,69 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_integer function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_integer")).to eq("function_is_integer")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_integer([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if an integer" do
+    result = scope.function_is_integer(["3"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if a negative integer" do
+    result = scope.function_is_integer(["-7"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if a float" do
+    result = scope.function_is_integer(["3.2"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a string" do
+    result = scope.function_is_integer(["asdf"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return true if an integer is created from an arithmetical operation" do
+    result = scope.function_is_integer([3*2])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if an array" do
+    result = scope.function_is_numeric([["asdf"]])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a hash" do
+    result = scope.function_is_numeric([{"asdf" => false}])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a boolean" do
+    result = scope.function_is_numeric([true])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a whitespace is in the string" do
+    result = scope.function_is_numeric([" -1324"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if it is zero prefixed" do
+    result = scope.function_is_numeric(["0001234"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if it is wrapped inside an array" do
+    result = scope.function_is_numeric([[1234]])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_ip_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_ip_address function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_ip_address")).to eq("function_is_ip_address")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_ip_address([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if an IPv4 address" do
+    result = scope.function_is_ip_address(["1.2.3.4"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if a full IPv6 address" do
+    result = scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if a compressed IPv6 address" do
+    result = scope.function_is_ip_address(["fe00::1"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if not valid" do
+    result = scope.function_is_ip_address(["asdf"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if IP octets out of range" do
+    result = scope.function_is_ip_address(["1.1.1.300"])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_mac_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,29 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_mac_address function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_mac_address")).to eq("function_is_mac_address")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_mac_address([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if a valid mac address" do
+    result = scope.function_is_mac_address(["00:a0:1f:12:7f:a0"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if octets are out of range" do
+    result = scope.function_is_mac_address(["00:a0:1f:12:7f:g0"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if not valid" do
+    result = scope.function_is_mac_address(["not valid"])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_numeric_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,119 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_numeric function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_numeric")).to eq("function_is_numeric")
+  end
+
+  it "should raise a ParseError if there is less than 1 argument" do
+    expect { scope.function_is_numeric([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if an integer" do
+    result = scope.function_is_numeric(["3"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if a float" do
+    result = scope.function_is_numeric(["3.2"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if an integer is created from an arithmetical operation" do
+    result = scope.function_is_numeric([3*2])
+    expect(result).to(eq(true))
+  end
+
+  it "should return true if a float is created from an arithmetical operation" do
+    result = scope.function_is_numeric([3.2*2])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if a string" do
+    result = scope.function_is_numeric(["asdf"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if an array" do
+    result = scope.function_is_numeric([["asdf"]])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if an array of integers" do
+    result = scope.function_is_numeric([[1,2,3,4]])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a hash" do
+    result = scope.function_is_numeric([{"asdf" => false}])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a hash with numbers in it" do
+    result = scope.function_is_numeric([{1 => 2}])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a boolean" do
+    result = scope.function_is_numeric([true])
+    expect(result).to(eq(false))
+  end
+
+  it "should return true if a negative float with exponent" do
+    result = scope.function_is_numeric(["-342.2315e-12"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if a negative integer with whitespaces before/after the dash" do
+    result = scope.function_is_numeric([" -  751"])
+    expect(result).to(eq(false))
+  end
+
+#  it "should return true if a hexadecimal" do
+#    result = scope.function_is_numeric(["0x52F8c"])
+#    result.should(eq(true))
+#  end
+#
+#  it "should return true if a hexadecimal with uppercase 0X prefix" do
+#    result = scope.function_is_numeric(["0X52F8c"])
+#    result.should(eq(true))
+#  end
+#
+#  it "should return false if a hexadecimal without a prefix" do
+#    result = scope.function_is_numeric(["52F8c"])
+#    result.should(eq(false))
+#  end
+#
+#  it "should return true if a octal" do
+#    result = scope.function_is_numeric(["0751"])
+#    result.should(eq(true))
+#  end
+#
+#  it "should return true if a negative hexadecimal" do
+#    result = scope.function_is_numeric(["-0x52F8c"])
+#    result.should(eq(true))
+#  end
+#
+#  it "should return true if a negative octal" do
+#    result = scope.function_is_numeric(["-0751"])
+#    result.should(eq(true))
+#  end
+#
+#  it "should return false if a negative octal with whitespaces before/after the dash" do
+#    result = scope.function_is_numeric([" -  0751"])
+#    result.should(eq(false))
+#  end
+#
+#  it "should return false if a bad hexadecimal" do
+#    result = scope.function_is_numeric(["0x23d7g"])
+#    result.should(eq(false))
+#  end
+#
+#  it "should return false if a bad octal" do
+#    result = scope.function_is_numeric(["0287"])
+#    result.should(eq(false))
+#  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/is_string_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the is_string function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("is_string")).to eq("function_is_string")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_is_string([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if a string" do
+    result = scope.function_is_string(["asdf"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if an integer" do
+    result = scope.function_is_string(["3"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if a float" do
+    result = scope.function_is_string(["3.23"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return false if an array" do
+    result = scope.function_is_string([["a","b","c"]])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/join_keys_to_values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,40 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the join_keys_to_values function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("join_keys_to_values")).to eq("function_join_keys_to_values")
+  end
+
+  it "should raise a ParseError if there are fewer than two arguments" do
+    expect { scope.function_join_keys_to_values([{}]) }.to raise_error Puppet::ParseError
+  end
+
+  it "should raise a ParseError if there are greater than two arguments" do
+    expect { scope.function_join_keys_to_values([{}, 'foo', 'bar']) }.to raise_error Puppet::ParseError
+  end
+
+  it "should raise a TypeError if the first argument is an array" do
+    expect { scope.function_join_keys_to_values([[1,2], ',']) }.to raise_error TypeError
+  end
+
+  it "should raise a TypeError if the second argument is an array" do
+    expect { scope.function_join_keys_to_values([{}, [1,2]]) }.to raise_error TypeError
+  end
+
+  it "should raise a TypeError if the second argument is a number" do
+    expect { scope.function_join_keys_to_values([{}, 1]) }.to raise_error TypeError
+  end
+
+  it "should return an empty array given an empty hash" do
+    result = scope.function_join_keys_to_values([{}, ":"])
+    expect(result).to eq([])
+  end
+
+  it "should join hash's keys to its values" do
+    result = scope.function_join_keys_to_values([{'a'=>1,2=>'foo',:b=>nil}, ":"])
+    expect(result).to match_array(['a:1','2:foo','b:'])
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/join_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the join function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("join")).to eq("function_join")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_join([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should join an array into a string" do
+    result = scope.function_join([["a","b","c"], ":"])
+    expect(result).to(eq("a:b:c"))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/keys_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,21 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the keys function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("keys")).to eq("function_keys")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_keys([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return an array of keys when given a hash" do
+    result = scope.function_keys([{'a'=>1, 'b'=>2}])
+    # =~ performs 'array with same elements' (set) matching
+    # For more info see RSpec::Matchers::MatchArray
+    expect(result).to match_array(['a','b'])
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/loadyaml_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,25 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the loadyaml function" do
+  include PuppetlabsSpec::Files
+
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("loadyaml")).to eq("function_loadyaml")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_loadyaml([]) }.to raise_error(Puppet::ParseError)
+  end
+
+  it "should convert YAML file to a data structure" do
+    yaml_file = tmpfilename ('yamlfile')
+    File.open(yaml_file, 'w') do |fh|
+      fh.write("---\n aaa: 1\n bbb: 2\n ccc: 3\n ddd: 4\n")
+    end
+    result = scope.function_loadyaml([yaml_file])
+    expect(result).to eq({"aaa" => 1, "bbb" => 2, "ccc" => 3, "ddd" => 4 })
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/lstrip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the lstrip function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("lstrip")).to eq("function_lstrip")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_lstrip([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should lstrip a string" do
+    result = scope.function_lstrip(["  asdf"])
+    expect(result).to(eq('asdf'))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new("  asdf")
+    result = scope.function_lstrip([value])
+    result.should(eq("asdf"))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/max_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the max function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("max")).to eq("function_max")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_max([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should be able to compare strings" do
+    expect(scope.function_max(["albatross","dog","horse"])).to(eq("horse"))
+  end
+
+  it "should be able to compare numbers" do
+    expect(scope.function_max([6,8,4])).to(eq(8))
+  end
+
+  it "should be able to compare a number with a stringified number" do
+    expect(scope.function_max([1,"2"])).to(eq("2"))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/member_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the member function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("member")).to eq("function_member")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_member([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if a member is in an array" do
+    result = scope.function_member([["a","b","c"], "a"])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if a member is not in an array" do
+    result = scope.function_member([["a","b","c"], "d"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return true if a member array is in an array" do
+    result = scope.function_member([["a","b","c"], ["a", "b"]])
+    expect(result).to(eq(true))
+  end
+
+  it "should return false if a member array is not in an array" do
+    result = scope.function_member([["a","b","c"], ["d", "e"]])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/merge_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,52 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:merge) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe 'when calling merge from puppet' do
+    it "should not compile when no arguments are passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = '$x = merge()'
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should not compile when 1 argument is passed" do
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      Puppet[:code] = "$my_hash={'one' => 1}\n$x = merge($my_hash)"
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+  end
+
+  describe 'when calling merge on the scope instance' do
+    it 'should require all parameters are hashes' do
+      expect { new_hash = scope.function_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/)
+      expect { new_hash = scope.function_merge([{}, 2])}.to raise_error(Puppet::ParseError, /unexpected argument type Fixnum/)
+    end
+
+    it 'should accept empty strings as puppet undef' do
+      expect { new_hash = scope.function_merge([{}, ''])}.not_to raise_error
+    end
+
+    it 'should be able to merge two hashes' do
+      new_hash = scope.function_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])
+      expect(new_hash['one']).to   eq('1')
+      expect(new_hash['two']).to   eq('2')
+      expect(new_hash['three']).to eq('2')
+    end
+
+    it 'should merge multiple hashes' do
+      hash = scope.function_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}])
+      expect(hash['one']).to eq('3')
+    end
+
+    it 'should accept empty hashes' do
+      expect(scope.function_merge([{},{},{}])).to eq({})
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/min_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the min function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("min")).to eq("function_min")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_min([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should be able to compare strings" do
+    expect(scope.function_min(["albatross","dog","horse"])).to(eq("albatross"))
+  end
+
+  it "should be able to compare numbers" do
+    expect(scope.function_min([6,8,4])).to(eq(4))
+  end
+
+  it "should be able to compare a number with a stringified number" do
+    expect(scope.function_min([1,"2"])).to(eq(1))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/num2bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,67 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the num2bool function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("num2bool")).to eq("function_num2bool")
+  end
+
+  it "should raise a ParseError if there are no arguments" do
+    expect { scope.function_num2bool([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if there are more than 1 arguments" do
+    expect { scope.function_num2bool(["foo","bar"]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if passed something non-numeric" do
+    expect { scope.function_num2bool(["xyzzy"]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return true if passed string 1" do
+    result = scope.function_num2bool(["1"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return true if passed string 1.5" do
+    result = scope.function_num2bool(["1.5"])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return true if passed number 1" do
+    result = scope.function_num2bool([1])
+    expect(result).to(be_truthy)
+  end
+
+  it "should return false if passed string 0" do
+    result = scope.function_num2bool(["0"])
+    expect(result).to(be_falsey)
+  end
+
+  it "should return false if passed number 0" do
+    result = scope.function_num2bool([0])
+    expect(result).to(be_falsey)
+  end
+
+  it "should return false if passed string -1" do
+    result = scope.function_num2bool(["-1"])
+    expect(result).to(be_falsey)
+  end
+
+  it "should return false if passed string -1.5" do
+    result = scope.function_num2bool(["-1.5"])
+    expect(result).to(be_falsey)
+  end
+
+  it "should return false if passed number -1" do
+    result = scope.function_num2bool([-1])
+    expect(result).to(be_falsey)
+  end
+
+  it "should return false if passed float -1.5" do
+    result = scope.function_num2bool([-1.5])
+    expect(result).to(be_falsey)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/parsejson_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the parsejson function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("parsejson")).to eq("function_parsejson")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_parsejson([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert JSON to a data structure" do
+    json = <<-EOS
+["aaa","bbb","ccc"]
+EOS
+    result = scope.function_parsejson([json])
+    expect(result).to(eq(['aaa','bbb','ccc']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/parseyaml_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the parseyaml function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("parseyaml")).to eq("function_parseyaml")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_parseyaml([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert YAML to a data structure" do
+    yaml = <<-EOS
+- aaa
+- bbb
+- ccc
+EOS
+    result = scope.function_parseyaml([yaml])
+    expect(result).to(eq(['aaa','bbb','ccc']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/pick_default_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,58 @@
+#!/usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the pick_default function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("pick_default")).to eq("function_pick_default")
+  end
+
+  it 'should return the correct value' do
+    expect(scope.function_pick_default(['first', 'second'])).to eq('first')
+  end
+
+  it 'should return the correct value if the first value is empty' do
+    expect(scope.function_pick_default(['', 'second'])).to eq('second')
+  end
+
+  it 'should skip empty string values' do
+    expect(scope.function_pick_default(['', 'first'])).to eq('first')
+  end
+
+  it 'should skip :undef values' do
+    expect(scope.function_pick_default([:undef, 'first'])).to eq('first')
+  end
+
+  it 'should skip :undefined values' do
+    expect(scope.function_pick_default([:undefined, 'first'])).to eq('first')
+  end
+
+  it 'should return the empty string if it is the last possibility' do
+    expect(scope.function_pick_default([:undef, :undefined, ''])).to eq('')
+  end
+
+  it 'should return :undef if it is the last possibility' do
+    expect(scope.function_pick_default(['', :undefined, :undef])).to eq(:undef)
+  end
+
+  it 'should return :undefined if it is the last possibility' do
+    expect(scope.function_pick_default([:undef, '', :undefined])).to eq(:undefined)
+  end
+
+  it 'should return the empty string if it is the only possibility' do
+    expect(scope.function_pick_default([''])).to eq('')
+  end
+
+  it 'should return :undef if it is the only possibility' do
+    expect(scope.function_pick_default([:undef])).to eq(:undef)
+  end
+
+  it 'should return :undefined if it is the only possibility' do
+    expect(scope.function_pick_default([:undefined])).to eq(:undefined)
+  end
+
+  it 'should error if no values are passed' do
+    expect { scope.function_pick_default([]) }.to raise_error(Puppet::Error, /Must receive at least one argument./)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/pick_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the pick function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("pick")).to eq("function_pick")
+  end
+
+  it 'should return the correct value' do
+    expect(scope.function_pick(['first', 'second'])).to eq('first')
+  end
+
+  it 'should return the correct value if the first value is empty' do
+    expect(scope.function_pick(['', 'second'])).to eq('second')
+  end
+
+  it 'should remove empty string values' do
+    expect(scope.function_pick(['', 'first'])).to eq('first')
+  end
+
+  it 'should remove :undef values' do
+    expect(scope.function_pick([:undef, 'first'])).to eq('first')
+  end
+
+  it 'should remove :undefined values' do
+    expect(scope.function_pick([:undefined, 'first'])).to eq('first')
+  end
+
+  it 'should error if no values are passed' do
+    expect { scope.function_pick([]) }.to( raise_error(Puppet::ParseError, "pick(): must receive at least one non empty value"))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/prefix_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the prefix function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "raises a ParseError if there is less than 1 arguments" do
+    expect { scope.function_prefix([]) }.to raise_error(Puppet::ParseError, /number of arguments/)
+  end
+
+  it "raises an error if the first argument is not an array" do
+    expect {
+      scope.function_prefix([Object.new])
+    }.to raise_error(Puppet::ParseError, /expected first argument to be an Array/)
+  end
+
+
+  it "raises an error if the second argument is not a string" do
+    expect {
+      scope.function_prefix([['first', 'second'], 42])
+    }.to raise_error(Puppet::ParseError, /expected second argument to be a String/)
+  end
+
+  it "returns a prefixed array" do
+    result = scope.function_prefix([['a','b','c'], 'p'])
+    expect(result).to(eq(['pa','pb','pc']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/range_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,86 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the range function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "exists" do
+    expect(Puppet::Parser::Functions.function("range")).to eq("function_range")
+  end
+
+  it "raises a ParseError if there is less than 1 arguments" do
+    expect { scope.function_range([]) }.to raise_error Puppet::ParseError, /Wrong number of arguments.*0 for 1/
+  end
+
+  describe 'with a letter range' do
+    it "returns a letter range" do
+      result = scope.function_range(["a","d"])
+      expect(result).to eq ['a','b','c','d']
+    end
+
+    it "returns a letter range given a step of 1" do
+      result = scope.function_range(["a","d","1"])
+      expect(result).to eq ['a','b','c','d']
+    end
+
+    it "returns a stepped letter range" do
+      result = scope.function_range(["a","d","2"])
+      expect(result).to eq ['a','c']
+    end
+
+    it "returns a stepped letter range given a negative step" do
+      result = scope.function_range(["a","d","-2"])
+      expect(result).to eq ['a','c']
+    end
+  end
+
+  describe 'with a number range' do
+    it "returns a number range" do
+      result = scope.function_range(["1","4"])
+      expect(result).to eq [1,2,3,4]
+    end
+
+    it "returns a number range given a step of 1" do
+      result = scope.function_range(["1","4","1"])
+      expect(result).to eq [1,2,3,4]
+    end
+
+    it "returns a stepped number range" do
+      result = scope.function_range(["1","4","2"])
+      expect(result).to eq [1,3]
+    end
+
+    it "returns a stepped number range given a negative step" do
+      result = scope.function_range(["1","4","-2"])
+      expect(result).to eq [1,3]
+    end
+  end
+
+  describe 'with a numeric-like string range' do
+    it "works with padded hostname like strings" do
+      expected = ("host01".."host10").to_a
+      expect(scope.function_range(["host01","host10"])).to eq expected
+    end
+
+    it "coerces zero padded digits to integers" do
+      expected = (0..10).to_a
+      expect(scope.function_range(["00", "10"])).to eq expected
+    end
+  end
+
+  describe 'with a numeric range' do
+    it "returns a range of numbers" do
+      expected = (1..10).to_a
+      expect(scope.function_range([1,10])).to eq expected
+    end
+    it "returns a range of numbers with step parameter" do
+      expected = (1..10).step(2).to_a
+      expect(scope.function_range([1,10,2])).to eq expected
+    end
+    it "works with mixed numeric like strings and numeric arguments" do
+      expected = (1..10).to_a
+      expect(scope.function_range(['1',10])).to eq expected
+      expect(scope.function_range([1,'10'])).to eq expected
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/reject_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+
+require 'spec_helper'
+
+describe "the reject function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("reject")).to eq("function_reject")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_reject([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should reject contents from an array" do
+    result = scope.function_reject([["1111", "aaabbb","bbbccc","dddeee"], "bbb"])
+    expect(result).to(eq(["1111", "dddeee"]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/reverse_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the reverse function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("reverse")).to eq("function_reverse")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_reverse([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should reverse a string" do
+    result = scope.function_reverse(["asdfghijkl"])
+    expect(result).to(eq('lkjihgfdsa'))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('asdfghjkl')
+    result = scope.function_reverse([value])
+    result.should(eq('lkjhgfdsa'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/rstrip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the rstrip function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("rstrip")).to eq("function_rstrip")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_rstrip([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should rstrip a string" do
+    result = scope.function_rstrip(["asdf  "])
+    expect(result).to(eq('asdf'))
+  end
+
+  it "should rstrip each element in an array" do
+    result = scope.function_rstrip([["a ","b ", "c "]])
+    expect(result).to(eq(['a','b','c']))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('asdf ')
+    result = scope.function_rstrip([value])
+    result.should(eq('asdf'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/shuffle_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the shuffle function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("shuffle")).to eq("function_shuffle")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_shuffle([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should shuffle a string and the result should be the same size" do
+    result = scope.function_shuffle(["asdf"])
+    expect(result.size).to(eq(4))
+  end
+
+  it "should shuffle a string but the sorted contents should still be the same" do
+    result = scope.function_shuffle(["adfs"])
+    expect(result.split("").sort.join("")).to(eq("adfs"))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('asdf')
+    result = scope.function_shuffle([value])
+    result.size.should(eq(4))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/size_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the size function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("size")).to eq("function_size")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_size([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return the size of a string" do
+    result = scope.function_size(["asdf"])
+    expect(result).to(eq(4))
+  end
+
+  it "should return the size of an array" do
+    result = scope.function_size([["a","b","c"]])
+    expect(result).to(eq(3))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/sort_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the sort function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("sort")).to eq("function_sort")
+  end
+
+  it "should raise a ParseError if there is not 1 arguments" do
+    expect { scope.function_sort(['','']) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should sort an array" do
+    result = scope.function_sort([["a","c","b"]])
+    expect(result).to(eq(['a','b','c']))
+  end
+
+  it "should sort a string" do
+    result = scope.function_sort(["acb"])
+    expect(result).to(eq('abc'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/squeeze_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the squeeze function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("squeeze")).to eq("function_squeeze")
+  end
+
+  it "should raise a ParseError if there is less than 2 arguments" do
+    expect { scope.function_squeeze([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should squeeze a string" do
+    result = scope.function_squeeze(["aaabbbbcccc"])
+    expect(result).to(eq('abc'))
+  end
+
+  it "should squeeze all elements in an array" do
+    result = scope.function_squeeze([["aaabbbbcccc","dddfff"]])
+    expect(result).to(eq(['abc','df']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/str2bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the str2bool function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("str2bool")).to eq("function_str2bool")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_str2bool([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert string 'true' to true" do
+    result = scope.function_str2bool(["true"])
+    expect(result).to(eq(true))
+  end
+
+  it "should convert string 'undef' to false" do
+    result = scope.function_str2bool(["undef"])
+    expect(result).to(eq(false))
+  end
+
+  it "should return the boolean it was called with" do
+    result = scope.function_str2bool([true])
+    expect(result).to(eq(true))
+    result = scope.function_str2bool([false])
+    expect(result).to(eq(false))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/str2saltedsha512_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,45 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the str2saltedsha512 function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("str2saltedsha512")).to eq("function_str2saltedsha512")
+  end
+
+  it "should raise a ParseError if there is less than 1 argument" do
+    expect { scope.function_str2saltedsha512([]) }.to( raise_error(Puppet::ParseError) )
+  end
+
+  it "should raise a ParseError if there is more than 1 argument" do
+    expect { scope.function_str2saltedsha512(['foo', 'bar', 'baz']) }.to( raise_error(Puppet::ParseError) )
+  end
+
+  it "should return a salted-sha512 password hash 136 characters in length" do
+    result = scope.function_str2saltedsha512(["password"])
+    expect(result.length).to(eq(136))
+  end
+
+  it "should raise an error if you pass a non-string password" do
+    expect { scope.function_str2saltedsha512([1234]) }.to( raise_error(Puppet::ParseError) )
+  end
+
+  it "should generate a valid password" do
+    # Allow the function to generate a password based on the string 'password'
+    password_hash = scope.function_str2saltedsha512(["password"])
+
+    # Separate the Salt and Password from the Password Hash
+    salt     = password_hash[0..7]
+    password = password_hash[8..-1]
+
+    # Convert the Salt and Password from Hex to Binary Data
+    str_salt     = Array(salt.lines).pack('H*')
+    str_password = Array(password.lines).pack('H*')
+
+    # Combine the Binary Salt with 'password' and compare the end result
+    saltedpass    = Digest::SHA512.digest(str_salt + 'password')
+    result        = (str_salt + saltedpass).unpack('H*')[0]
+    expect(result).to eq(password_hash)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/strftime_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,29 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the strftime function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("strftime")).to eq("function_strftime")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_strftime([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "using %s should be higher then when I wrote this test" do
+    result = scope.function_strftime(["%s"])
+    expect(result.to_i).to(be > 1311953157)
+  end
+
+  it "using %s should be lower then 1.5 trillion" do
+    result = scope.function_strftime(["%s"])
+    expect(result.to_i).to(be < 1500000000)
+  end
+
+  it "should return a date when given %Y-%m-%d" do
+    result = scope.function_strftime(["%Y-%m-%d"])
+    expect(result).to match(/^\d{4}-\d{2}-\d{2}$/)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/strip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the strip function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("strip")).to eq("function_strip")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_strip([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should strip a string" do
+    result = scope.function_strip([" ab cd "])
+    expect(result).to(eq('ab cd'))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new(' as df ')
+    result = scope.function_strip([value])
+    result.should(eq('as df'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/suffix_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the suffix function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "raises a ParseError if there is less than 1 arguments" do
+    expect { scope.function_suffix([]) }.to raise_error(Puppet::ParseError, /number of arguments/)
+  end
+
+  it "raises an error if the first argument is not an array" do
+    expect {
+      scope.function_suffix([Object.new])
+    }.to raise_error(Puppet::ParseError, /expected first argument to be an Array/)
+  end
+
+  it "raises an error if the second argument is not a string" do
+    expect {
+      scope.function_suffix([['first', 'second'], 42])
+    }.to raise_error(Puppet::ParseError, /expected second argument to be a String/)
+  end
+
+  it "returns a suffixed array" do
+    result = scope.function_suffix([['a','b','c'], 'p'])
+    expect(result).to(eq(['ap','bp','cp']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/swapcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,28 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the swapcase function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("swapcase")).to eq("function_swapcase")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_swapcase([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should swapcase a string" do
+    result = scope.function_swapcase(["aaBBccDD"])
+    expect(result).to(eq('AAbbCCdd'))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new("aaBBccDD")
+    result = scope.function_swapcase([value])
+    result.should(eq("AAbbCCdd"))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/time_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,29 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the time function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("time")).to eq("function_time")
+  end
+
+  it "should raise a ParseError if there is more than 2 arguments" do
+    expect { scope.function_time(['','']) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return a number" do
+    result = scope.function_time([])
+    expect(result).to be_an(Integer)
+  end
+
+  it "should be higher then when I wrote this test" do
+    result = scope.function_time([])
+    expect(result).to(be > 1311953157)
+  end
+
+  it "should be lower then 1.5 trillion" do
+    result = scope.function_time([])
+    expect(result).to(be < 1500000000)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/to_bytes_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,83 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the to_bytes function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("to_bytes")).to eq("function_to_bytes")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_to_bytes([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert kB to B" do
+    result = scope.function_to_bytes(["4 kB"])
+    expect(result).to(eq(4096))
+  end
+
+  it "should convert MB to B" do
+    result = scope.function_to_bytes(["4 MB"])
+    expect(result).to(eq(4194304))
+  end
+
+  it "should convert GB to B" do
+    result = scope.function_to_bytes(["4 GB"])
+    expect(result).to(eq(4294967296))
+  end
+
+  it "should convert TB to B" do
+    result = scope.function_to_bytes(["4 TB"])
+    expect(result).to(eq(4398046511104))
+  end
+
+  it "should convert PB to B" do
+    result = scope.function_to_bytes(["4 PB"])
+    expect(result).to(eq(4503599627370496))
+  end
+
+  it "should convert PB to B" do
+    result = scope.function_to_bytes(["4 EB"])
+    expect(result).to(eq(4611686018427387904))
+  end
+
+  it "should work without B in unit" do
+    result = scope.function_to_bytes(["4 k"])
+    expect(result).to(eq(4096))
+  end
+
+  it "should work without a space before unit" do
+    result = scope.function_to_bytes(["4k"])
+    expect(result).to(eq(4096))
+  end
+
+  it "should work without a unit" do
+    result = scope.function_to_bytes(["5678"])
+    expect(result).to(eq(5678))
+  end
+
+  it "should convert fractions" do
+    result = scope.function_to_bytes(["1.5 kB"])
+    expect(result).to(eq(1536))
+  end
+
+  it "should convert scientific notation" do
+    result = scope.function_to_bytes(["1.5e2 B"])
+    expect(result).to(eq(150))
+  end
+
+  it "should do nothing with a positive number" do
+    result = scope.function_to_bytes([5678])
+    expect(result).to(eq(5678))
+  end
+
+  it "should should raise a ParseError if input isn't a number" do
+    expect { scope.function_to_bytes(["foo"]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should should raise a ParseError if prefix is unknown" do
+    expect { scope.function_to_bytes(["5 uB"]) }.to( raise_error(Puppet::ParseError))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/type_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,43 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the type function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("type")).to eq("function_type")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_type([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return string when given a string" do
+    result = scope.function_type(["aaabbbbcccc"])
+    expect(result).to(eq('string'))
+  end
+
+  it "should return array when given an array" do
+    result = scope.function_type([["aaabbbbcccc","asdf"]])
+    expect(result).to(eq('array'))
+  end
+
+  it "should return hash when given a hash" do
+    result = scope.function_type([{"a"=>1,"b"=>2}])
+    expect(result).to(eq('hash'))
+  end
+
+  it "should return integer when given an integer" do
+    result = scope.function_type(["1"])
+    expect(result).to(eq('integer'))
+  end
+
+  it "should return float when given a float" do
+    result = scope.function_type(["1.34"])
+    expect(result).to(eq('float'))
+  end
+
+  it "should return boolean when given a boolean" do
+    result = scope.function_type([true])
+    expect(result).to(eq('boolean'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/union_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,19 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the union function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("union")).to eq("function_union")
+  end
+
+  it "should raise a ParseError if there are fewer than 2 arguments" do
+    expect { scope.function_union([]) }.to( raise_error(Puppet::ParseError) )
+  end
+
+  it "should join two arrays together" do
+    result = scope.function_union([["a","b","c"],["b","c","d"]])
+    expect(result).to(eq(["a","b","c","d"]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/unique_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the unique function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("unique")).to eq("function_unique")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_unique([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should remove duplicate elements in a string" do
+    result = scope.function_unique(["aabbc"])
+    expect(result).to(eq('abc'))
+  end
+
+  it "should remove duplicate elements in an array" do
+    result = scope.function_unique([["a","a","b","b","c"]])
+    expect(result).to(eq(['a','b','c']))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('aabbc')
+    result = scope.function_unique([value])
+    result.should(eq('abc'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/upcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the upcase function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("upcase")).to eq("function_upcase")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_upcase([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should upcase a string" do
+    result = scope.function_upcase(["abc"])
+    expect(result).to(eq('ABC'))
+  end
+
+  it "should do nothing if a string is already upcase" do
+    result = scope.function_upcase(["ABC"])
+    expect(result).to(eq('ABC'))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('abc')
+    result = scope.function_upcase([value])
+    result.should(eq('ABC'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/uriescape_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the uriescape function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("uriescape")).to eq("function_uriescape")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_uriescape([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should uriescape a string" do
+    result = scope.function_uriescape([":/?#[]@!$&'()*+,;= \"{}"])
+    expect(result).to(eq(':/?%23[]@!$&\'()*+,;=%20%22%7B%7D'))
+  end
+
+  it "should do nothing if a string is already safe" do
+    result = scope.function_uriescape(["ABCdef"])
+    expect(result).to(eq('ABCdef'))
+  end
+
+  it "should accept objects which extend String" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('abc')
+    result = scope.function_uriescape([value])
+    result.should(eq('abc'))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_absolute_path_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,84 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_absolute_path) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  # The subject of these examples is the method itself.
+  subject do
+    # This makes sure the function is loaded within each test
+    function_name = Puppet::Parser::Functions.function(:validate_absolute_path)
+    scope.method(function_name)
+  end
+
+  describe "Valid Paths" do
+    def self.valid_paths
+      %w{
+        C:/
+        C:\\
+        C:\\WINDOWS\\System32
+        C:/windows/system32
+        X:/foo/bar
+        X:\\foo\\bar
+        /var/tmp
+        /var/lib/puppet
+        /var/opt/../lib/puppet
+      }
+    end
+
+    context "Without Puppet::Util.absolute_path? (e.g. Puppet <= 2.6)" do
+      before :each do
+        # The intent here is to mock Puppet to behave like Puppet 2.6 does.
+        # Puppet 2.6 does not have the absolute_path? method.  This is only a
+        # convenience test, stdlib should be run with the Puppet 2.6.x in the
+        # $LOAD_PATH in addition to 2.7.x and master.
+        Puppet::Util.expects(:respond_to?).with(:absolute_path?).returns(false)
+      end
+      valid_paths.each do |path|
+        it "validate_absolute_path(#{path.inspect}) should not fail" do
+          expect { subject.call [path] }.not_to raise_error
+        end
+      end
+    end
+
+    context "Puppet without mocking" do
+      valid_paths.each do |path|
+        it "validate_absolute_path(#{path.inspect}) should not fail" do
+          expect { subject.call [path] }.not_to raise_error
+        end
+      end
+    end
+  end
+
+  describe 'Invalid paths' do
+    context 'Garbage inputs' do
+      [
+        nil,
+        [ nil ],
+        { 'foo' => 'bar' },
+        { },
+        '',
+      ].each do |path|
+        it "validate_absolute_path(#{path.inspect}) should fail" do
+          expect { subject.call [path] }.to raise_error Puppet::ParseError
+        end
+      end
+    end
+
+    context 'Relative paths' do
+      %w{
+        relative1
+        .
+        ..
+        ./foo
+        ../foo
+        etc/puppetlabs/puppet
+        opt/puppet/bin
+      }.each do |path|
+        it "validate_absolute_path(#{path.inspect}) should fail" do
+          expect { subject.call [path] }.to raise_error Puppet::ParseError
+        end
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_array_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,38 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_array) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  describe 'when calling validate_array from puppet' do
+
+    %w{ true false }.each do |the_string|
+      it "should not compile when #{the_string} is a string" do
+        Puppet[:code] = "validate_array('#{the_string}')"
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
+      end
+
+      it "should not compile when #{the_string} is a bare word" do
+        Puppet[:code] = "validate_array(#{the_string})"
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
+      end
+    end
+
+    it "should compile when multiple array arguments are passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = [ ]
+        $bar = [ 'one', 'two' ]
+        validate_array($foo, $bar)
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+
+    it "should not compile when an undef variable is passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = undef
+        validate_array($foo)
+      ENDofPUPPETcode
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_augeas_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,103 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_augeas), :if => Puppet.features.augeas? do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  # The subject of these examplres is the method itself.
+  subject do
+    # This makes sure the function is loaded within each test
+    function_name = Puppet::Parser::Functions.function(:validate_augeas)
+    scope.method(function_name)
+  end
+
+  context 'Using Puppet::Parser::Scope.new' do
+
+    describe 'Garbage inputs' do
+      inputs = [
+        [ nil ],
+        [ [ nil ] ],
+        [ { 'foo' => 'bar' } ],
+        [ { } ],
+        [ '' ],
+        [ "one", "one", "MSG to User", "4th arg" ],
+      ]
+
+      inputs.each do |input|
+        it "validate_augeas(#{input.inspect}) should fail" do
+          expect { subject.call [input] }.to raise_error Puppet::ParseError
+        end
+      end
+    end
+
+    describe 'Valid inputs' do
+      inputs = [
+        [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns' ],
+        [ "proc /proc   proc    nodev,noexec,nosuid     0       0\n", 'Fstab.lns'],
+      ]
+
+      inputs.each do |input|
+        it "validate_augeas(#{input.inspect}) should not fail" do
+          expect { subject.call input }.not_to raise_error
+        end
+      end
+    end
+
+    describe "Valid inputs which should raise an exception without a message" do
+      # The intent here is to make sure valid inputs raise exceptions when they
+      # don't specify an error message to display.  This is the behvior in
+      # 2.2.x and prior.
+      inputs = [
+        [ "root:x:0:0:root\n", 'Passwd.lns' ],
+        [ "127.0.1.1\n", 'Hosts.lns' ],
+      ]
+
+      inputs.each do |input|
+        it "validate_augeas(#{input.inspect}) should fail" do
+          expect { subject.call input }.to raise_error /validate_augeas.*?matched less than it should/
+        end
+      end
+    end
+
+    describe "Nicer Error Messages" do
+      # The intent here is to make sure the function returns the 3rd argument
+      # in the exception thrown
+      inputs = [
+        [ "root:x:0:0:root\n", 'Passwd.lns', [], 'Failed to validate passwd content' ],
+        [ "127.0.1.1\n", 'Hosts.lns', [], 'Wrong hosts content' ],
+      ]
+
+      inputs.each do |input|
+        it "validate_augeas(#{input.inspect}) should fail" do
+          expect { subject.call input }.to raise_error /#{input[2]}/
+        end
+      end
+    end
+
+    describe "Passing simple unit tests" do
+      inputs = [
+        [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']],
+        [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']],
+      ]
+
+      inputs.each do |input|
+        it "validate_augeas(#{input.inspect}) should fail" do
+          expect { subject.call input }.not_to raise_error
+        end
+      end
+    end
+
+    describe "Failing simple unit tests" do
+      inputs = [
+        [ "foobar:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']],
+        [ "root:x:0:0:root:/root:/bin/sh\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']],
+      ]
+
+      inputs.each do |input|
+        it "validate_augeas(#{input.inspect}) should fail" do
+          expect { subject.call input }.to raise_error /testing path/
+        end
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_bool_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,51 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_bool) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+  describe 'when calling validate_bool from puppet' do
+
+    %w{ true false }.each do |the_string|
+
+      it "should not compile when #{the_string} is a string" do
+        Puppet[:code] = "validate_bool('#{the_string}')"
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
+      end
+
+      it "should compile when #{the_string} is a bare word" do
+        Puppet[:code] = "validate_bool(#{the_string})"
+        scope.compiler.compile
+      end
+
+    end
+
+    it "should not compile when an arbitrary string is passed" do
+      Puppet[:code] = 'validate_bool("jeff and dan are awesome")'
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
+    end
+
+    it "should not compile when no arguments are passed" do
+      Puppet[:code] = 'validate_bool()'
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+
+    it "should compile when multiple boolean arguments are passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = true
+        $bar = false
+        validate_bool($foo, $bar, true, false)
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+
+    it "should compile when multiple boolean arguments are passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = true
+        $bar = false
+        validate_bool($foo, $bar, true, false, 'jeff')
+      ENDofPUPPETcode
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_cmd_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,48 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+TESTEXE = File.exists?('/usr/bin/test') ? '/usr/bin/test' : '/bin/test'
+TOUCHEXE = File.exists?('/usr/bin/touch') ? '/usr/bin/touch' : '/bin/touch'
+
+describe Puppet::Parser::Functions.function(:validate_cmd) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  subject do
+    function_name = Puppet::Parser::Functions.function(:validate_cmd)
+    scope.method(function_name)
+  end
+
+  describe "with an explicit failure message" do
+    it "prints the failure message on error" do
+      expect {
+        subject.call ['', '/bin/false', 'failure message!']
+      }.to raise_error Puppet::ParseError, /failure message!/
+    end
+  end
+
+  describe "on validation failure" do
+    it "includes the command error output" do
+      expect {
+        subject.call ['', "#{TOUCHEXE} /cant/touch/this"]
+      }.to raise_error Puppet::ParseError, /(cannot touch|o such file or)/
+    end
+
+    it "includes the command return value" do
+      expect {
+        subject.call ['', '/cant/run/this']
+      }.to raise_error Puppet::ParseError, /returned 1\b/
+    end
+  end
+
+  describe "when performing actual validation" do
+    it "can positively validate file content" do
+      expect { subject.call ["non-empty", "#{TESTEXE} -s"] }.to_not raise_error
+    end
+
+    it "can negatively validate file content" do
+      expect {
+        subject.call ["", "#{TESTEXE} -s"]
+      }.to raise_error Puppet::ParseError, /failed to validate.*test -s/
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_hash_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,43 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_hash) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe 'when calling validate_hash from puppet' do
+
+    %w{ true false }.each do |the_string|
+
+      it "should not compile when #{the_string} is a string" do
+        Puppet[:code] = "validate_hash('#{the_string}')"
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
+      end
+
+      it "should not compile when #{the_string} is a bare word" do
+        Puppet[:code] = "validate_hash(#{the_string})"
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
+      end
+
+    end
+
+    it "should compile when multiple hash arguments are passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = {}
+        $bar = { 'one' => 'two' }
+        validate_hash($foo, $bar)
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+
+    it "should not compile when an undef variable is passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = undef
+        validate_hash($foo)
+      ENDofPUPPETcode
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
+    end
+
+  end
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_ipv4_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,64 @@
+#! /usr/bin/env ruby -S rspec
+
+require "spec_helper"
+
+describe Puppet::Parser::Functions.function(:validate_ipv4_address) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe "when calling validate_ipv4_address from puppet" do
+    describe "when given IPv4 address strings" do
+      it "should compile with one argument" do
+        Puppet[:code] = "validate_ipv4_address('1.2.3.4')"
+        scope.compiler.compile
+      end
+
+      it "should compile with multiple arguments" do
+        Puppet[:code] = "validate_ipv4_address('1.2.3.4', '5.6.7.8')"
+        scope.compiler.compile
+      end
+    end
+
+    describe "when given an IPv6 address" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv4_address('3ffe:505')"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /not a valid IPv4 address/)
+      end
+    end
+
+    describe "when given other strings" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv4_address('hello', 'world')"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /not a valid IPv4 address/)
+      end
+    end
+
+    describe "when given numbers" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv4_address(1, 2)"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /is not a valid IPv4 address/)
+      end
+    end
+
+    describe "when given booleans" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv4_address(true, false)"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /is not a string/)
+      end
+    end
+
+    it "should not compile when no arguments are passed" do
+      Puppet[:code] = "validate_ipv4_address()"
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_ipv6_address_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,67 @@
+#! /usr/bin/env ruby -S rspec
+
+require "spec_helper"
+
+describe Puppet::Parser::Functions.function(:validate_ipv6_address) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe "when calling validate_ipv6_address from puppet" do
+    describe "when given IPv6 address strings" do
+      it "should compile with one argument" do
+        Puppet[:code] = "validate_ipv6_address('3ffe:0505:0002::')"
+        scope.compiler.compile
+      end
+
+      it "should compile with multiple arguments" do
+        Puppet[:code] = "validate_ipv6_address('3ffe:0505:0002::', '3ffe:0505:0001::')"
+        scope.compiler.compile
+      end
+    end
+
+    describe "when given an ipv4 address" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv6_address('1.2.3.4')"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /not a valid IPv6 address/)
+      end
+    end
+
+    describe "when given other strings" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv6_address('hello', 'world')"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /not a valid IPv6 address/)
+      end
+    end
+
+    # 1.8.7 is EOL'd and also absolutely insane about ipv6
+    unless RUBY_VERSION == '1.8.7'
+      describe "when given numbers" do
+        it "should not compile" do
+          Puppet[:code] = "validate_ipv6_address(1, 2)"
+          expect {
+            scope.compiler.compile
+          }.to raise_error(Puppet::ParseError, /not a valid IPv6 address/)
+        end
+      end
+    end
+
+    describe "when given booleans" do
+      it "should not compile" do
+        Puppet[:code] = "validate_ipv6_address(true, false)"
+        expect {
+          scope.compiler.compile
+        }.to raise_error(Puppet::ParseError, /is not a string/)
+      end
+    end
+
+    it "should not compile when no arguments are passed" do
+      Puppet[:code] = "validate_ipv6_address()"
+      expect {
+        scope.compiler.compile
+      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_re_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,77 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_re) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  # The subject of these examplres is the method itself.
+  subject do
+    # This makes sure the function is loaded within each test
+    function_name = Puppet::Parser::Functions.function(:validate_re)
+    scope.method(function_name)
+  end
+
+  context 'Using Puppet::Parser::Scope.new' do
+
+    describe 'Garbage inputs' do
+      inputs = [
+        [ nil ],
+        [ [ nil ] ],
+        [ { 'foo' => 'bar' } ],
+        [ { } ],
+        [ '' ],
+        [ "one", "one", "MSG to User", "4th arg" ],
+      ]
+
+      inputs.each do |input|
+        it "validate_re(#{input.inspect}) should fail" do
+          expect { subject.call [input] }.to raise_error Puppet::ParseError
+        end
+      end
+    end
+
+    describe 'Valid inputs' do
+      inputs = [
+        [ '/full/path/to/something', '^/full' ],
+        [ '/full/path/to/something', 'full' ],
+        [ '/full/path/to/something', ['full', 'absent'] ],
+        [ '/full/path/to/something', ['full', 'absent'], 'Message to the user' ],
+      ]
+
+      inputs.each do |input|
+        it "validate_re(#{input.inspect}) should not fail" do
+          expect { subject.call input }.not_to raise_error
+        end
+      end
+    end
+    describe "Valid inputs which should raise an exception without a message" do
+      # The intent here is to make sure valid inputs raise exceptions when they
+      # don't specify an error message to display.  This is the behvior in
+      # 2.2.x and prior.
+      inputs = [
+        [ "hello", [ "bye", "later", "adios" ] ],
+        [ "greetings", "salutations" ],
+      ]
+
+      inputs.each do |input|
+        it "validate_re(#{input.inspect}) should fail" do
+          expect { subject.call input }.to raise_error /validate_re.*?does not match/
+        end
+      end
+    end
+    describe "Nicer Error Messages" do
+      # The intent here is to make sure the function returns the 3rd argument
+      # in the exception thrown
+      inputs = [
+        [ "hello", [ "bye", "later", "adios" ], "MSG to User" ],
+        [ "greetings", "salutations", "Error, greetings does not match salutations" ],
+      ]
+
+      inputs.each do |input|
+        it "validate_re(#{input.inspect}) should fail" do
+          expect { subject.call input }.to raise_error /#{input[2]}/
+        end
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_slength_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,67 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe "the validate_slength function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("validate_slength")).to eq("function_validate_slength")
+  end
+
+  describe "validating the input argument types" do
+    it "raises an error if there are less than two arguments" do
+      expect { scope.function_validate_slength([]) }.to raise_error Puppet::ParseError, /Wrong number of arguments/
+    end
+
+    it "raises an error if there are more than three arguments" do
+      expect { scope.function_validate_slength(['input', 1, 2, 3]) }.to raise_error Puppet::ParseError, /Wrong number of arguments/
+    end
+
+    it "raises an error if the first argument is not a string" do
+      expect { scope.function_validate_slength([Object.new, 2, 1]) }.to raise_error Puppet::ParseError, /Expected first argument.*got .*Object/
+    end
+
+    it "raises an error if the second argument cannot be cast to an Integer" do
+      expect { scope.function_validate_slength(['input', Object.new]) }.to raise_error Puppet::ParseError, /Expected second argument.*got .*Object/
+    end
+
+    it "raises an error if the third argument cannot be cast to an Integer" do
+      expect { scope.function_validate_slength(['input', 1, Object.new]) }.to raise_error Puppet::ParseError, /Expected third argument.*got .*Object/
+    end
+
+    it "raises an error if the second argument is smaller than the third argument" do
+      expect { scope.function_validate_slength(['input', 1, 2]) }.to raise_error Puppet::ParseError, /Expected second argument to be larger than third argument/
+    end
+  end
+
+  describe "validating the input string length" do
+    describe "when the input is a string" do
+      it "fails validation if the string is larger than the max length" do
+        expect { scope.function_validate_slength(['input', 1]) }.to raise_error Puppet::ParseError, /Expected length .* between 0 and 1, was 5/
+      end
+
+      it "fails validation if the string is less than the min length" do
+        expect { scope.function_validate_slength(['input', 10, 6]) }.to raise_error Puppet::ParseError, /Expected length .* between 6 and 10, was 5/
+      end
+
+      it "doesn't raise an error if the string is under the max length" do
+        scope.function_validate_slength(['input', 10])
+      end
+
+      it "doesn't raise an error if the string is equal to the max length" do
+        scope.function_validate_slength(['input', 5])
+      end
+
+      it "doesn't raise an error if the string is equal to the min length" do
+        scope.function_validate_slength(['input', 10, 5])
+      end
+    end
+
+    describe "when the input is an array" do
+      it "fails validation if one of the array elements is not a string" do
+        expect { scope.function_validate_slength([["a", "b", Object.new], 2]) }.to raise_error Puppet::ParseError, /Expected element at array position 2 .*String, got .*Object/
+      end
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/validate_string_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,60 @@
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:validate_string) do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  describe 'when calling validate_string from puppet' do
+
+    %w{ foo bar baz }.each do |the_string|
+
+      it "should compile when #{the_string} is a string" do
+        Puppet[:code] = "validate_string('#{the_string}')"
+        scope.compiler.compile
+      end
+
+      it "should compile when #{the_string} is a bare word" do
+        Puppet[:code] = "validate_string(#{the_string})"
+        scope.compiler.compile
+      end
+
+    end
+
+    %w{ true false }.each do |the_string|
+      it "should compile when #{the_string} is a string" do
+        Puppet[:code] = "validate_string('#{the_string}')"
+        scope.compiler.compile
+      end
+
+      it "should not compile when #{the_string} is a bare word" do
+        Puppet[:code] = "validate_string(#{the_string})"
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a string/)
+      end
+    end
+
+    it "should compile when multiple string arguments are passed" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = ''
+        $bar = 'two'
+        validate_string($foo, $bar)
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+
+    it "should compile when an explicitly undef variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        $foo = undef
+        validate_string($foo)
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+
+    it "should compile when an undefined variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do
+      Puppet[:code] = <<-'ENDofPUPPETcode'
+        validate_string($foobarbazishouldnotexist)
+      ENDofPUPPETcode
+      scope.compiler.compile
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/values_at_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,38 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the values_at function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("values_at")).to eq("function_values_at")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_values_at([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should raise a ParseError if you try to use a range where stop is greater then start" do
+    expect { scope.function_values_at([['a','b'],["3-1"]]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return a value at from an array" do
+    result = scope.function_values_at([['a','b','c'],"1"])
+    expect(result).to(eq(['b']))
+  end
+
+  it "should return a value at from an array when passed a range" do
+    result = scope.function_values_at([['a','b','c'],"0-1"])
+    expect(result).to(eq(['a','b']))
+  end
+
+  it "should return chosen values from an array when passed number of indexes" do
+    result = scope.function_values_at([['a','b','c'],["0","2"]])
+    expect(result).to(eq(['a','c']))
+  end
+
+  it "should return chosen values from an array when passed ranges and multiple indexes" do
+    result = scope.function_values_at([['a','b','c','d','e','f','g'],["0","2","4-5"]])
+    expect(result).to(eq(['a','c','e','f']))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/values_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the values function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("values")).to eq("function_values")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_values([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should return values from a hash" do
+    result = scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}])
+    # =~ is the RSpec::Matchers::MatchArray matcher.
+    # A.K.A. "array with same elements" (multiset) matching
+    expect(result).to match_array(%w{ 1 2 3 })
+  end
+
+  it "should return a multiset" do
+    result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}])
+    expect(result).to     match_array(%w{ 1 3 3 })
+    expect(result).not_to match_array(%w{ 1 3 })
+  end
+
+  it "should raise a ParseError unless a Hash is provided" do
+    expect { scope.function_values([['a','b','c']]) }.to( raise_error(Puppet::ParseError))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/functions/zip_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the zip function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_zip([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should be able to zip an array" do
+    result = scope.function_zip([['1','2','3'],['4','5','6']])
+    expect(result).to(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
+    result = scope.function_zip([['1','2','3'],['4','5','6'], false])
+    result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
+  end
+
+  it "should be able to zip an array and flatten" do
+    result = scope.function_zip([['1','2','3'],['4','5','6'], true])
+    result.should(eq(["1", "4", "2", "5", "3", "6"]))
+  end
+
+  it "should accept objects which extend String for the second argument" do
+    class AlsoString < String
+    end
+
+    value = AlsoString.new('false')
+    result = scope.function_zip([['1','2','3'],['4','5','6'],value])
+    result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/compiler.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,47 @@
+#! /usr/bin/env ruby -S rspec
+module PuppetSpec::Compiler
+  def compile_to_catalog(string, node = Puppet::Node.new('foonode'))
+    Puppet[:code] = string
+    Puppet::Parser::Compiler.compile(node)
+  end
+
+  def compile_to_ral(manifest)
+    catalog = compile_to_catalog(manifest)
+    ral = catalog.to_ral
+    ral.finalize
+    ral
+  end
+
+  def compile_to_relationship_graph(manifest, prioritizer = Puppet::Graph::SequentialPrioritizer.new)
+    ral = compile_to_ral(manifest)
+    graph = Puppet::Graph::RelationshipGraph.new(prioritizer)
+    graph.populate_from(ral)
+    graph
+  end
+
+  if Puppet.version.to_f >= 3.3
+    def apply_compiled_manifest(manifest, prioritizer = Puppet::Graph::SequentialPrioritizer.new)
+      transaction = Puppet::Transaction.new(compile_to_ral(manifest),
+                                          Puppet::Transaction::Report.new("apply"),
+                                          prioritizer)
+      transaction.evaluate
+      transaction.report.finalize_report
+
+      transaction
+    end
+  else
+    def apply_compiled_manifest(manifest)
+      transaction = Puppet::Transaction.new(compile_to_ral(manifest), Puppet::Transaction::Report.new("apply"))
+      transaction.evaluate
+      transaction.report.finalize_report
+
+      transaction
+    end
+  end
+
+  def order_resources_traversed_in(relationships)
+    order_seen = []
+    relationships.traverse { |resource| order_seen << resource.ref }
+    order_seen
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/database.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,30 @@
+#! /usr/bin/env ruby -S rspec
+# This just makes some nice things available at global scope, and for setup of
+# tests to use a real fake database, rather than a fake stubs-that-don't-work
+# version of the same.  Fun times.
+def sqlite?
+  if $sqlite.nil?
+    begin
+      require 'sqlite3'
+      $sqlite = true
+    rescue LoadError
+      $sqlite = false
+    end
+  end
+  $sqlite
+end
+
+def can_use_scratch_database?
+  sqlite? and Puppet.features.rails?
+end
+
+
+# This is expected to be called in your `before :each` block, and will get you
+# ready to roll with a serious database and all.  Cleanup is handled
+# automatically for you.  Nothing to do there.
+def setup_scratch_database
+  Puppet[:dbadapter] = 'sqlite3'
+  Puppet[:dblocation] = ':memory:'
+  Puppet[:railslog] = PuppetSpec::Files.tmpfile('storeconfigs.log')
+  Puppet::Rails.init
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/files.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,61 @@
+#! /usr/bin/env ruby -S rspec
+require 'fileutils'
+require 'tempfile'
+require 'tmpdir'
+require 'pathname'
+
+# A support module for testing files.
+module PuppetSpec::Files
+  def self.cleanup
+    $global_tempfiles ||= []
+    while path = $global_tempfiles.pop do
+      begin
+        Dir.unstub(:entries)
+        FileUtils.rm_rf path, :secure => true
+      rescue Errno::ENOENT
+        # nothing to do
+      end
+    end
+  end
+
+  def make_absolute(path) PuppetSpec::Files.make_absolute(path) end
+  def self.make_absolute(path)
+    path = File.expand_path(path)
+    path[0] = 'c' if Puppet.features.microsoft_windows?
+    path
+  end
+
+  def tmpfile(name, dir = nil) PuppetSpec::Files.tmpfile(name, dir) end
+  def self.tmpfile(name, dir = nil)
+    # Generate a temporary file, just for the name...
+    source = dir ? Tempfile.new(name, dir) : Tempfile.new(name)
+    path = source.path
+    source.close!
+
+    record_tmp(File.expand_path(path))
+
+    path
+  end
+
+  def file_containing(name, contents) PuppetSpec::Files.file_containing(name, contents) end
+  def self.file_containing(name, contents)
+    file = tmpfile(name)
+    File.open(file, 'wb') { |f| f.write(contents) }
+    file
+  end
+
+  def tmpdir(name) PuppetSpec::Files.tmpdir(name) end
+  def self.tmpdir(name)
+    dir = Dir.mktmpdir(name)
+
+    record_tmp(dir)
+
+    dir
+  end
+
+  def self.record_tmp(tmp)
+    # ...record it for cleanup,
+    $global_tempfiles ||= []
+    $global_tempfiles << tmp
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/fixtures.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,29 @@
+#! /usr/bin/env ruby -S rspec
+module PuppetSpec::Fixtures
+  def fixtures(*rest)
+    File.join(PuppetSpec::FIXTURE_DIR, *rest)
+  end
+  def my_fixture_dir
+    callers = caller
+    while line = callers.shift do
+      next unless found = line.match(%r{/spec/(.*)_spec\.rb:})
+      return fixtures(found[1])
+    end
+    fail "sorry, I couldn't work out your path from the caller stack!"
+  end
+  def my_fixture(name)
+    file = File.join(my_fixture_dir, name)
+    unless File.readable? file then
+      fail Puppet::DevError, "fixture '#{name}' for #{my_fixture_dir} is not readable"
+    end
+    return file
+  end
+  def my_fixtures(glob = '*', flags = 0)
+    files = Dir.glob(File.join(my_fixture_dir, glob), flags)
+    unless files.length > 0 then
+      fail Puppet::DevError, "fixture '#{glob}' for #{my_fixture_dir} had no files!"
+    end
+    block_given? and files.each do |file| yield file end
+    files
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/matchers.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,121 @@
+#! /usr/bin/env ruby -S rspec
+require 'stringio'
+
+########################################################################
+# Backward compatibility for Jenkins outdated environment.
+module RSpec
+  module Matchers
+    module BlockAliases
+      alias_method :to,     :should      unless method_defined? :to
+      alias_method :to_not, :should_not  unless method_defined? :to_not
+      alias_method :not_to, :should_not  unless method_defined? :not_to
+    end
+  end
+end
+
+
+########################################################################
+# Custom matchers...
+RSpec::Matchers.define :have_matching_element do |expected|
+  match do |actual|
+    actual.any? { |item| item =~ expected }
+  end
+end
+
+
+RSpec::Matchers.define :exit_with do |expected|
+  actual = nil
+  match do |block|
+    begin
+      block.call
+    rescue SystemExit => e
+      actual = e.status
+    end
+    actual and actual == expected
+  end
+  failure_message_for_should do |block|
+    "expected exit with code #{expected} but " +
+      (actual.nil? ? " exit was not called" : "we exited with #{actual} instead")
+  end
+  failure_message_for_should_not do |block|
+    "expected that exit would not be called with #{expected}"
+  end
+  description do
+    "expect exit with #{expected}"
+  end
+end
+
+class HavePrintedMatcher
+  attr_accessor :expected, :actual
+
+  def initialize(expected)
+    case expected
+    when String, Regexp
+      @expected = expected
+    else
+      @expected = expected.to_s
+    end
+  end
+
+  def matches?(block)
+    begin
+      $stderr = $stdout = StringIO.new
+      $stdout.set_encoding('UTF-8') if $stdout.respond_to?(:set_encoding)
+      block.call
+      $stdout.rewind
+      @actual = $stdout.read
+    ensure
+      $stdout = STDOUT
+      $stderr = STDERR
+    end
+
+    if @actual then
+      case @expected
+      when String
+        @actual.include? @expected
+      when Regexp
+        @expected.match @actual
+      end
+    else
+      false
+    end
+  end
+
+  def failure_message_for_should
+    if @actual.nil? then
+      "expected #{@expected.inspect}, but nothing was printed"
+    else
+      "expected #{@expected.inspect} to be printed; got:\n#{@actual}"
+    end
+  end
+
+  def failure_message_for_should_not
+    "expected #{@expected.inspect} to not be printed; got:\n#{@actual}"
+  end
+
+  def description
+    "expect #{@expected.inspect} to be printed"
+  end
+end
+
+def have_printed(what)
+  HavePrintedMatcher.new(what)
+end
+
+RSpec::Matchers.define :equal_attributes_of do |expected|
+  match do |actual|
+    actual.instance_variables.all? do |attr|
+      actual.instance_variable_get(attr) == expected.instance_variable_get(attr)
+    end
+  end
+end
+
+RSpec::Matchers.define :be_one_of do |*expected|
+  match do |actual|
+    expected.include? actual
+  end
+
+  failure_message_for_should do |actual|
+    "expected #{actual.inspect} to be one of #{expected.map(&:inspect).join(' or ')}"
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/modules.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby -S rspec
+module PuppetSpec::Modules
+  class << self
+    def create(name, dir, options = {})
+      module_dir = File.join(dir, name)
+      FileUtils.mkdir_p(module_dir)
+
+      environment = options[:environment]
+
+      if metadata = options[:metadata]
+        metadata[:source]  ||= 'github'
+        metadata[:author]  ||= 'puppetlabs'
+        metadata[:version] ||= '9.9.9'
+        metadata[:license] ||= 'to kill'
+        metadata[:dependencies] ||= []
+
+        metadata[:name] = "#{metadata[:author]}/#{name}"
+
+        File.open(File.join(module_dir, 'metadata.json'), 'w') do |f|
+          f.write(metadata.to_pson)
+        end
+      end
+
+      Puppet::Module.new(name, module_dir, environment)
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/pops.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,17 @@
+#! /usr/bin/env ruby -S rspec
+module PuppetSpec::Pops
+  extend RSpec::Matchers::DSL
+
+  # Checks if an Acceptor has a specific issue in its list of diagnostics
+  matcher :have_issue do |expected|
+    match do |actual|
+      actual.diagnostics.index { |i| i.issue == expected } != nil
+    end
+    failure_message_for_should do |actual|
+      "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to contain issue #{expected.issue_code}"
+    end
+    failure_message_for_should_not do |actual|
+      "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to not contain issue #{expected.issue_code}"
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/scope.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,15 @@
+#! /usr/bin/env ruby -S rspec
+
+module PuppetSpec::Scope
+  # Initialize a new scope suitable for testing.
+  #
+  def create_test_scope_for_node(node_name)
+    node = Puppet::Node.new(node_name)
+    compiler = Puppet::Parser::Compiler.new(node)
+    scope = Puppet::Parser::Scope.new(compiler)
+    scope.source = Puppet::Resource::Type.new(:node, node_name)
+    scope.parent = compiler.topscope
+    scope
+  end
+
+end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/settings.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,16 @@
+#! /usr/bin/env ruby -S rspec
+module PuppetSpec::Settings
+
+  # It would probably be preferable to refactor defaults.rb such that the real definitions of
+  #  these settings were available as a variable, which was then accessible for use during tests.
+  #  However, I'm not doing that yet because I don't want to introduce any additional moving parts
+  #  to this already very large changeset.
+  #  Would be nice to clean this up later.  --cprice 2012-03-20
+  TEST_APP_DEFAULT_DEFINITIONS = {
+    :name         => { :default => "test", :desc => "name" },
+    :logdir       => { :type => :directory, :default => "test", :desc => "logdir" },
+    :confdir      => { :type => :directory, :default => "test", :desc => "confdir" },
+    :vardir       => { :type => :directory, :default => "test", :desc => "vardir" },
+    :rundir       => { :type => :directory, :default => "test", :desc => "rundir" },
+  }
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/lib/puppet_spec/verbose.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,10 @@
+#! /usr/bin/env ruby -S rspec
+# Support code for running stuff with warnings disabled.
+module Kernel
+  def with_verbose_disabled
+    verbose, $VERBOSE = $VERBOSE, nil
+    result = yield
+    $VERBOSE = verbose
+    return result
+  end
+end
--- a/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
 require 'rspec'
 
 class Object
--- a/modules/stdlib/spec/monkey_patches/publicize_methods.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/monkey_patches/publicize_methods.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
 # Some monkey-patching to allow us to test private methods.
 class Class
     def publicize_methods(*methods)
--- a/modules/stdlib/spec/spec_helper.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/spec_helper.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,21 +1,27 @@
+#! /usr/bin/env ruby -S rspec
 dir = File.expand_path(File.dirname(__FILE__))
 $LOAD_PATH.unshift File.join(dir, 'lib')
 
-# Don't want puppet getting the command line arguments for rake or autotest
-ARGV.clear
+# So everyone else doesn't have to include this base constant.
+module PuppetSpec
+  FIXTURE_DIR = File.join(dir = File.expand_path(File.dirname(__FILE__)), "fixtures") unless defined?(FIXTURE_DIR)
+end
 
 require 'puppet'
-require 'facter'
-require 'mocha'
-gem 'rspec', '>=2.0.0'
-require 'rspec/expectations'
+require 'rspec-puppet'
+require 'puppetlabs_spec_helper/module_spec_helper'
+require 'puppet_spec/verbose'
+require 'puppet_spec/files'
+require 'puppet_spec/settings'
+require 'puppet_spec/fixtures'
+require 'puppet_spec/matchers'
+require 'puppet_spec/database'
+require 'monkey_patches/alias_should_to_must'
+require 'mocha/setup'
 
-require 'puppetlabs_spec_helper/module_spec_helper'
+
 
 RSpec.configure do |config|
-  # FIXME REVISIT - We may want to delegate to Facter like we do in
-  # Puppet::PuppetSpecInitializer.initialize_via_testhelper(config) because
-  # this behavior is a duplication of the spec_helper in Facter.
   config.before :each do
     # Ensure that we don't accidentally cache facts and environment between
     # test cases.  This requires each example group to explicitly load the
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/spec_helper_acceptance.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,50 @@
+#! /usr/bin/env ruby -S rspec
+require 'beaker-rspec'
+
+UNSUPPORTED_PLATFORMS = []
+
+unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
+  foss_opts = {
+    :default_action => 'gem_install',
+    :version        => (ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : '3.7.2'),
+  }
+
+  if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
+
+  hosts.each do |host|
+    if host['platform'] !~ /windows/i
+      if host.is_pe?
+        on host, 'mkdir -p /etc/puppetlabs/facter/facts.d'
+      else
+        on host, "/bin/touch #{host['puppetpath']}/hiera.yaml"
+        on host, "mkdir -p #{host['distmoduledir']}"
+        on host, 'mkdir -p /etc/facter/facts.d'
+      end
+    end
+  end
+end
+
+RSpec.configure do |c|
+  # Project root
+  proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+  # Readable test descriptions
+  c.formatter = :documentation
+
+  # Configure all nodes in nodeset
+  c.before :suite do
+    if ENV['FUTURE_PARSER'] == 'true'
+      default[:default_apply_opts] ||= {}
+      default[:default_apply_opts].merge!({:parser => 'future'})
+    end
+
+    copy_root_module_to(default, :source => proj_root, :module_name => 'stdlib')
+  end
+end
+
+def is_future_parser_enabled?
+  if default[:default_apply_opts]
+    return default[:default_apply_opts][:parser] == 'future'
+  end
+  return false
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,32 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+require 'facter/facter_dot_d'
+
+describe Facter::Util::DotD do
+
+  context 'returns a simple fact' do
+    before :each do
+      Facter.stubs(:version).returns('1.6.1')
+      subject.stubs(:entries).returns(['/etc/facter/facts.d/fake_fact.txt'])
+      File.stubs(:readlines).with('/etc/facter/facts.d/fake_fact.txt').returns(['fake_fact=fake fact'])
+      subject.create
+    end
+
+    it 'should return successfully' do
+      expect(Facter.fact(:fake_fact).value).to eq('fake fact')
+    end
+  end
+
+  context 'returns a fact with equals signs' do
+    before :each do
+      Facter.stubs(:version).returns('1.6.1')
+      subject.stubs(:entries).returns(['/etc/facter/facts.d/foo.txt'])
+      File.stubs(:readlines).with('/etc/facter/facts.d/foo.txt').returns(['foo=1+1=2'])
+      subject.create
+    end
+
+    it 'should return successfully' do
+      expect(Facter.fact(:foo).value).to eq('1+1=2')
+    end
+  end
+end
--- a/modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-# Puppet Enterprise requires the following facts to be set in order to operate.
-# These facts are set using the file ???? and the two facts are
-# `fact_stomp_port`, and `fact_stomp_server`.
-#
-
-require 'spec_helper'
-
-describe "External facts in /etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt" do
-  context "With Facter 1.6.17 which does not have external facts support" do
-    before :each do
-      Facter.stubs(:version).returns("1.6.17")
-      # Stub out the filesystem for stdlib
-      Dir.stubs(:entries).with("/etc/puppetlabs/facter/facts.d").
-        returns(['puppet_enterprise_installer.txt'])
-      Dir.stubs(:entries).with("/etc/facter/facts.d").returns([])
-      File.stubs(:readlines).with('/etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt').
-        returns([
-          "fact_stomp_port=61613\n",
-          "fact_stomp_server=puppetmaster.acme.com\n",
-          "fact_is_puppetagent=true\n",
-          "fact_is_puppetmaster=false\n",
-          "fact_is_puppetca=false\n",
-          "fact_is_puppetconsole=false\n",
-      ])
-      if Facter.collection.respond_to? :load
-        Facter.collection.load(:facter_dot_d)
-      else
-        Facter.collection.loader.load(:facter_dot_d)
-      end
-    end
-
-    it 'defines fact_stomp_port' do
-      Facter.fact(:fact_stomp_port).value.should == '61613'
-    end
-    it 'defines fact_stomp_server' do
-      Facter.fact(:fact_stomp_server).value.should == 'puppetmaster.acme.com'
-    end
-    it 'defines fact_is_puppetagent' do
-      Facter.fact(:fact_is_puppetagent).value.should == 'true'
-    end
-    it 'defines fact_is_puppetmaster' do
-      Facter.fact(:fact_is_puppetmaster).value.should == 'false'
-    end
-    it 'defines fact_is_puppetca' do
-      Facter.fact(:fact_is_puppetca).value.should == 'false'
-    end
-    it 'defines fact_is_puppetconsole' do
-      Facter.fact(:fact_is_puppetconsole).value.should == 'false'
-    end
-  end
-
-  [ '1.7.1', '2.0.1' ].each do |v|
-    context "With Facter #{v} which has external facts support" do
-      before :each do
-        Facter.stubs(:version).returns(v)
-      end
-
-      it 'does not call Facter::Util::DotD.new' do
-        Facter::Util::DotD.expects(:new).never
-
-        if Facter.collection.respond_to? :load
-          Facter.collection.load(:facter_dot_d)
-        else
-          Facter.collection.loader.load(:facter_dot_d)
-        end
-      end
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/facter/pe_version_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/unit/facter/pe_version_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -26,23 +26,23 @@
         (major,minor,patch) = version.split(".")
 
         it "Should return true" do
-          Facter.fact(:is_pe).value.should == true
+          expect(Facter.fact(:is_pe).value).to eq(true)
         end
 
         it "Should have a version of #{version}" do
-          Facter.fact(:pe_version).value.should == version
+          expect(Facter.fact(:pe_version).value).to eq(version)
         end
 
         it "Should have a major version of #{major}" do
-          Facter.fact(:pe_major_version).value.should == major
+          expect(Facter.fact(:pe_major_version).value).to eq(major)
         end
 
         it "Should have a minor version of #{minor}" do
-          Facter.fact(:pe_minor_version).value.should == minor
+          expect(Facter.fact(:pe_minor_version).value).to eq(minor)
         end
 
         it "Should have a patch version of #{patch}" do
-          Facter.fact(:pe_patch_version).value.should == patch
+          expect(Facter.fact(:pe_patch_version).value).to eq(patch)
         end
       end
     end
@@ -54,23 +54,23 @@
     end
 
     it "is_pe is false" do
-      Facter.fact(:is_pe).value.should == false
+      expect(Facter.fact(:is_pe).value).to eq(false)
     end
 
     it "pe_version is nil" do
-      Facter.fact(:pe_version).value.should be_nil
+      expect(Facter.fact(:pe_version).value).to be_nil
     end
 
     it "pe_major_version is nil" do
-      Facter.fact(:pe_major_version).value.should be_nil
+      expect(Facter.fact(:pe_major_version).value).to be_nil
     end
 
     it "pe_minor_version is nil" do
-      Facter.fact(:pe_minor_version).value.should be_nil
+      expect(Facter.fact(:pe_minor_version).value).to be_nil
     end
 
     it "Should have a patch version" do
-      Facter.fact(:pe_patch_version).value.should be_nil
+      expect(Facter.fact(:pe_patch_version).value).to be_nil
     end
   end
 end
--- a/modules/stdlib/spec/unit/facter/root_home_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/unit/facter/root_home_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
 require 'spec_helper'
 require 'facter/root_home'
 
@@ -8,7 +9,7 @@
 
     it "should return /" do
       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
-      Facter::Util::RootHome.get_root_home.should == expected_root_home
+      expect(Facter::Util::RootHome.get_root_home).to eq(expected_root_home)
     end
   end
   context "linux" do
@@ -17,16 +18,7 @@
 
     it "should return /root" do
       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
-      Facter::Util::RootHome.get_root_home.should == expected_root_home
-    end
-  end
-  context "macosx" do
-    let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" }
-    let(:expected_root_home) { "/var/root" }
-
-    it "should return /var/root" do
-      Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
-      Facter::Util::RootHome.get_root_home.should == expected_root_home
+      expect(Facter::Util::RootHome.get_root_home).to eq(expected_root_home)
     end
   end
   context "windows" do
@@ -34,7 +26,27 @@
       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(nil)
     end
     it "should be nil on windows" do
-      Facter::Util::RootHome.get_root_home.should be_nil
+      expect(Facter::Util::RootHome.get_root_home).to be_nil
     end
   end
 end
+
+describe 'root_home', :type => :fact do
+  before { Facter.clear }
+  after { Facter.clear }
+
+  context "macosx" do
+    before do
+      Facter.fact(:kernel).stubs(:value).returns("Darwin")
+      Facter.fact(:osfamily).stubs(:value).returns("Darwin")
+    end
+    let(:expected_root_home) { "/var/root" }
+    sample_dscacheutil = File.read(fixtures('dscacheutil','root'))
+
+    it "should return /var/root" do
+      Facter::Util::Resolution.stubs(:exec).with("dscacheutil -q user -a name root").returns(sample_dscacheutil)
+      expect(Facter.fact(:root_home).value).to eq(expected_root_home)
+    end
+  end
+
+end
--- a/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
 require 'spec_helper'
 require 'facter/util/puppet_settings'
 
@@ -10,11 +11,11 @@
       end
 
       it 'should be nil' do
-        subject.with_puppet { Puppet[:vardir] }.should be_nil
+        expect(subject.with_puppet { Puppet[:vardir] }).to be_nil
       end
       it 'should not yield to the block' do
         Puppet.expects(:[]).never
-        subject.with_puppet { Puppet[:vardir] }.should be_nil
+        expect(subject.with_puppet { Puppet[:vardir] }).to be_nil
       end
     end
     context "With Puppet loaded" do
@@ -28,7 +29,7 @@
         subject.with_puppet { Puppet[:vardir] }
       end
       it 'should return the nodes vardir' do
-        subject.with_puppet { Puppet[:vardir] }.should eq vardir
+        expect(subject.with_puppet { Puppet[:vardir] }).to eq vardir
       end
     end
   end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the abs function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("abs").should == "function_abs"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_abs([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert a negative number into a positive" do
-    result = scope.function_abs(["-34"])
-    result.should(eq(34))
-  end
-
-  it "should do nothing with a positive number" do
-    result = scope.function_abs(["5678"])
-    result.should(eq(5678))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the any2array function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("any2array").should == "function_any2array"
-  end
-
-  it "should return an empty array if there is less than 1 argument" do
-    result = scope.function_any2array([])
-    result.should(eq([]))
-  end
-
-  it "should convert boolean true to [ true ] " do
-    result = scope.function_any2array([true])
-    result.should(eq([true]))
-  end
-
-  it "should convert one object to [object]" do
-    result = scope.function_any2array(['one'])
-    result.should(eq(['one']))
-  end
-
-  it "should convert multiple objects to [objects]" do
-    result = scope.function_any2array(['one', 'two'])
-    result.should(eq(['one', 'two']))
-  end
-
-  it "should return empty array it was called with" do
-    result = scope.function_any2array([[]])
-    result.should(eq([]))
-  end
-
-  it "should return one-member array it was called with" do
-    result = scope.function_any2array([['string']])
-    result.should(eq(['string']))
-  end
-
-  it "should return multi-member array it was called with" do
-    result = scope.function_any2array([['one', 'two']])
-    result.should(eq(['one', 'two']))
-  end
-
-  it "should return members of a hash it was called with" do
-    result = scope.function_any2array([{ 'key' => 'value' }])
-    result.should(eq(['key', 'value']))
-  end
-
-  it "should return an empty array if it was called with an empty hash" do
-    result = scope.function_any2array([{ }])
-    result.should(eq([]))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the bool2num function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("bool2num").should == "function_bool2num"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert true to 1" do
-    result = scope.function_bool2num([true])
-    result.should(eq(1))
-  end
-
-  it "should convert false to 0" do
-    result = scope.function_bool2num([false])
-    result.should(eq(0))
-  end
-end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/unit/puppet/parser/functions/bool2str_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,46 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the bool2str function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("bool2str")).to eq("function_bool2str")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_bool2str([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should convert true to 'true'" do
+    result = scope.function_bool2str([true])
+    expect(result).to(eq('true'))
+  end
+
+  it "should convert true to a string" do
+    result = scope.function_bool2str([true])
+    expect(result.class).to(eq(String))
+  end
+
+  it "should convert false to 'false'" do
+    result = scope.function_bool2str([false])
+    expect(result).to(eq('false'))
+  end
+
+  it "should convert false to a string" do
+    result = scope.function_bool2str([false])
+    expect(result.class).to(eq(String))
+  end
+
+  it "should not accept a string" do
+    expect { scope.function_bool2str(["false"]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should not accept a nil value" do
+    expect { scope.function_bool2str([nil]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should not accept an undef" do
+    expect { scope.function_bool2str([:undef]) }.to( raise_error(Puppet::ParseError))
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/stdlib/spec/unit/puppet/parser/functions/camelcase_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+
+describe "the camelcase function" do
+  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+  it "should exist" do
+    expect(Puppet::Parser::Functions.function("camelcase")).to eq("function_camelcase")
+  end
+
+  it "should raise a ParseError if there is less than 1 arguments" do
+    expect { scope.function_camelcase([]) }.to( raise_error(Puppet::ParseError))
+  end
+
+  it "should capitalize the beginning of a normal string" do
+    result = scope.function_camelcase(["abc"])
+    expect(result).to(eq("Abc"))
+  end
+
+  it "should camelcase an underscore-delimited string" do
+    result = scope.function_camelcase(["aa_bb_cc"])
+    expect(result).to(eq("AaBbCc"))
+  end
+end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the capitalize function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("capitalize").should == "function_capitalize"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should capitalize the beginning of a string" do
-    result = scope.function_capitalize(["abc"])
-    result.should(eq("Abc"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the chomp function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("chomp").should == "function_chomp"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_chomp([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should chomp the end of a string" do
-    result = scope.function_chomp(["abc\n"])
-    result.should(eq("abc"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the chop function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("chop").should == "function_chop"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_chop([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should chop the end of a string" do
-    result = scope.function_chop(["asdf\n"])
-    result.should(eq("asdf"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the concat function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_concat([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should be able to concat an array" do
-    result = scope.function_concat([['1','2','3'],['4','5','6']])
-    result.should(eq(['1','2','3','4','5','6']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the count function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("count").should == "function_count"
-  end
-
-  it "should raise a ArgumentError if there is more than 2 arguments" do
-    lambda { scope.function_count(['foo', 'bar', 'baz']) }.should( raise_error(ArgumentError))
-  end
-
-  it "should be able to count arrays" do
-    scope.function_count([["1","2","3"]]).should(eq(3))
-  end
-
-  it "should be able to count matching elements in arrays" do
-    scope.function_count([["1", "2", "2"], "2"]).should(eq(2))
-  end
-
-  it "should not count nil or empty strings" do
-    scope.function_count([["foo","bar",nil,""]]).should(eq(2))
-  end
-
-  it 'does not count an undefined hash key or an out of bound array index (which are both :undef)' do
-    expect(scope.function_count([["foo",:undef,:undef]])).to eq(1)
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the delete_at function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("delete_at").should == "function_delete_at"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_delete_at([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should delete an item at specified location from an array" do
-    result = scope.function_delete_at([['a','b','c'],1])
-    result.should(eq(['a','c']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the delete function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("delete").should == "function_delete"
-  end
-
-  it "should raise a ParseError if there are fewer than 2 arguments" do
-    lambda { scope.function_delete([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a ParseError if there are greater than 2 arguments" do
-    lambda { scope.function_delete([[], 'foo', 'bar']) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a TypeError if a number is passed as the first argument" do
-    lambda { scope.function_delete([1, 'bar']) }.should( raise_error(TypeError))
-  end
-
-  it "should delete all instances of an element from an array" do
-    result = scope.function_delete([['a','b','c','b'],'b'])
-    result.should(eq(['a','c']))
-  end
-
-  it "should delete all instances of a substring from a string" do
-    result = scope.function_delete(['foobarbabarz','bar'])
-    result.should(eq('foobaz'))
-  end
-
-  it "should delete a key from a hash" do
-    result = scope.function_delete([{ 'a' => 1, 'b' => 2, 'c' => 3 },'b'])
-    result.should(eq({ 'a' => 1, 'c' => 3 }))
-  end
-
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the dirname function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("dirname").should == "function_dirname"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_dirname([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return dirname for an absolute path" do
-    result = scope.function_dirname(['/path/to/a/file.ext'])
-    result.should(eq('/path/to/a'))
-  end
-
-  it "should return dirname for a relative path" do
-    result = scope.function_dirname(['path/to/a/file.ext'])
-    result.should(eq('path/to/a'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the downcase function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("downcase").should == "function_downcase"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_downcase([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should downcase a string" do
-    result = scope.function_downcase(["ASFD"])
-    result.should(eq("asfd"))
-  end
-
-  it "should do nothing to a string that is already downcase" do
-    result = scope.function_downcase(["asdf asdf"])
-    result.should(eq("asdf asdf"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the empty function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  it "should exist" do
-    Puppet::Parser::Functions.function("empty").should == "function_empty"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_empty([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return a true for an empty string" do
-    result = scope.function_empty([''])
-    result.should(eq(true))
-  end
-
-  it "should return a false for a non-empty string" do
-    result = scope.function_empty(['asdf'])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the flatten function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  it "should exist" do
-    Puppet::Parser::Functions.function("flatten").should == "function_flatten"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_flatten([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a ParseError if there is more than 1 argument" do
-    lambda { scope.function_flatten([[], []]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should flatten a complex data structure" do
-    result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]])
-    result.should(eq(["a","b","c","d","e","f","g"]))
-  end
-
-  it "should do nothing to a structure that is already flat" do
-    result = scope.function_flatten([["a","b","c","d"]])
-    result.should(eq(["a","b","c","d"]))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the floor function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("floor").should == "function_floor"
-  end
-
-  it "should raise a ParseError if there is less than 1 argument" do
-    lambda { scope.function_floor([]) }.should( raise_error(Puppet::ParseError, /Wrong number of arguments/))
-  end
-
-  it "should should raise a ParseError if input isn't numeric (eg. String)" do
-    lambda { scope.function_floor(["foo"]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/))
-  end
-
-  it "should should raise a ParseError if input isn't numeric (eg. Boolean)" do
-    lambda { scope.function_floor([true]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/))
-  end
-
-  it "should return an integer when a numeric type is passed" do
-    result = scope.function_floor([12.4])
-    result.is_a?(Integer).should(eq(true))
-  end
-
-  it "should return the input when an integer is passed" do
-    result = scope.function_floor([7])
-    result.should(eq(7))
-  end
-
-  it "should return the largest integer less than or equal to the input" do
-    result = scope.function_floor([3.8])
-    result.should(eq(3))
-  end
-end
-
--- a/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the fqdn_rotate function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("fqdn_rotate").should == "function_fqdn_rotate"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_fqdn_rotate([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should rotate a string and the result should be the same size" do
-    scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
-    result = scope.function_fqdn_rotate(["asdf"])
-    result.size.should(eq(4))
-  end
-
-  it "should rotate a string to give the same results for one host" do
-    scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1").twice
-    scope.function_fqdn_rotate(["abcdefg"]).should eql(scope.function_fqdn_rotate(["abcdefg"]))
-  end
-
-  it "should rotate a string to give different values on different hosts" do
-     scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
-     val1 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
-     scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.2")
-     val2 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
-     val1.should_not eql(val2)
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:get_module_path) do
-  Internals = PuppetlabsSpec::PuppetInternals
-  class StubModule
-    attr_reader :path
-    def initialize(path)
-      @path = path
-    end
-  end
-
-  def scope(environment = "production")
-    Internals.scope(:compiler => Internals.compiler(:node => Internals.node(:environment => environment)))
-  end
-
-  it 'should only allow one argument' do
-    expect { scope.function_get_module_path([]) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
-    expect { scope.function_get_module_path(['1','2','3']) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
-  end
-  it 'should raise an exception when the module cannot be found' do
-    expect { scope.function_get_module_path(['foo']) }.to raise_error(Puppet::ParseError, /Could not find module/)
-  end
-  describe 'when locating a module' do
-    let(:modulepath) { "/tmp/does_not_exist" }
-    let(:path_of_module_foo) { StubModule.new("/tmp/does_not_exist/foo") }
-
-    before(:each) { Puppet[:modulepath] = modulepath }
-
-    it 'should be able to find module paths from the modulepath setting' do
-      Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo)
-      scope.function_get_module_path(['foo']).should == path_of_module_foo.path
-    end
-    it 'should be able to find module paths when the modulepath is a list' do
-      Puppet[:modulepath] = modulepath + ":/tmp"
-      Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo)
-      scope.function_get_module_path(['foo']).should == path_of_module_foo.path
-    end
-    it 'should respect the environment' do
-      pending("Disabled on Puppet 2.6.x") if Puppet.version =~ /^2\.6\b/
-      Puppet.settings[:environment] = 'danstestenv'
-      Puppet::Module.expects(:find).with('foo', 'danstestenv').returns(path_of_module_foo)
-      scope('danstestenv').function_get_module_path(['foo']).should == path_of_module_foo.path
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:getvar) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  describe 'when calling getvar from puppet' do
-
-    it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = '$foo = getvar()'
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-
-    it "should not compile when too many arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = '$foo = getvar("foo::bar", "baz")'
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-
-    it "should lookup variables in other namespaces" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        class site::data { $foo = 'baz' }
-        include site::data
-        $foo = getvar("site::data::foo")
-        if $foo != 'baz' {
-          fail('getvar did not return what we expect')
-        }
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the grep function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("grep").should == "function_grep"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_grep([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should grep contents from an array" do
-    result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"])
-    result.should(eq(["aaabbb","bbbccc"]))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#!/usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:has_interface_with) do
-
-  let(:scope) do
-    PuppetlabsSpec::PuppetInternals.scope
-  end
-
-  # The subject of these examples is the method itself.
-  subject do
-    function_name = Puppet::Parser::Functions.function(:has_interface_with)
-    scope.method(function_name)
-  end
-
-  # We need to mock out the Facts so we can specify how we expect this function
-  # to behave on different platforms.
-  context "On Mac OS X Systems" do
-    before :each do
-      scope.stubs(:lookupvar).with("interfaces").returns('lo0,gif0,stf0,en1,p2p0,fw0,en0,vmnet1,vmnet8,utun0')
-    end
-    it 'should have loopback (lo0)' do
-      subject.call(['lo0']).should be_true
-    end
-    it 'should not have loopback (lo)' do
-      subject.call(['lo']).should be_false
-    end
-  end
-  context "On Linux Systems" do
-    before :each do
-      scope.stubs(:lookupvar).with("interfaces").returns('eth0,lo')
-      scope.stubs(:lookupvar).with("ipaddress").returns('10.0.0.1')
-      scope.stubs(:lookupvar).with("ipaddress_lo").returns('127.0.0.1')
-      scope.stubs(:lookupvar).with("ipaddress_eth0").returns('10.0.0.1')
-      scope.stubs(:lookupvar).with('muppet').returns('kermit')
-      scope.stubs(:lookupvar).with('muppet_lo').returns('mspiggy')
-      scope.stubs(:lookupvar).with('muppet_eth0').returns('kermit')
-    end
-    it 'should have loopback (lo)' do
-      subject.call(['lo']).should be_true
-    end
-    it 'should not have loopback (lo0)' do
-      subject.call(['lo0']).should be_false
-    end
-    it 'should have ipaddress with 127.0.0.1' do
-      subject.call(['ipaddress', '127.0.0.1']).should be_true
-    end
-    it 'should have ipaddress with 10.0.0.1' do
-      subject.call(['ipaddress', '10.0.0.1']).should be_true
-    end
-    it 'should not have ipaddress with 10.0.0.2' do
-      subject.call(['ipaddress', '10.0.0.2']).should be_false
-    end
-    it 'should have muppet named kermit' do
-      subject.call(['muppet', 'kermit']).should be_true
-    end
-    it 'should have muppet named mspiggy' do
-      subject.call(['muppet', 'mspiggy']).should be_true
-    end
-    it 'should not have muppet named bigbird' do
-      subject.call(['muppet', 'bigbird']).should be_false
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#!/usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:has_ip_address) do
-
-  let(:scope) do
-    PuppetlabsSpec::PuppetInternals.scope
-  end
-
-  subject do
-    function_name = Puppet::Parser::Functions.function(:has_ip_address)
-    scope.method(function_name)
-  end
-
-  context "On Linux Systems" do
-    before :each do
-      scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo')
-      scope.stubs(:lookupvar).with('ipaddress').returns('10.0.2.15')
-      scope.stubs(:lookupvar).with('ipaddress_eth0').returns('10.0.2.15')
-      scope.stubs(:lookupvar).with('ipaddress_lo').returns('127.0.0.1')
-    end
-
-    it 'should have primary address (10.0.2.15)' do
-      subject.call(['10.0.2.15']).should be_true
-    end
-
-    it 'should have lookupback address (127.0.0.1)' do
-      subject.call(['127.0.0.1']).should be_true
-    end
-
-    it 'should not have other address' do
-      subject.call(['192.1681.1.1']).should be_false
-    end
-
-    it 'should not have "mspiggy" on an interface' do
-      subject.call(['mspiggy']).should be_false
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#!/usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:has_ip_network) do
-
-  let(:scope) do
-    PuppetlabsSpec::PuppetInternals.scope
-  end
-
-  subject do
-    function_name = Puppet::Parser::Functions.function(:has_ip_network)
-    scope.method(function_name)
-  end
-
-  context "On Linux Systems" do
-    before :each do
-      scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo')
-      scope.stubs(:lookupvar).with('network').returns(:undefined)
-      scope.stubs(:lookupvar).with('network_eth0').returns('10.0.2.0')
-      scope.stubs(:lookupvar).with('network_lo').returns('127.0.0.1')
-    end
-
-    it 'should have primary network (10.0.2.0)' do
-      subject.call(['10.0.2.0']).should be_true
-    end
-
-    it 'should have loopback network (127.0.0.0)' do
-      subject.call(['127.0.0.1']).should be_true
-    end
-
-    it 'should not have other network' do
-      subject.call(['192.168.1.0']).should be_false
-    end
-  end
-end
-
--- a/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:has_key) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  describe 'when calling has_key from puppet' do
-    it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = '$x = has_key()'
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-
-    it "should not compile when 1 argument is passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = "$x = has_key('foo')"
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-
-    it "should require the first value to be a Hash" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = "$x = has_key('foo', 'bar')"
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /expects the first argument to be a hash/)
-    end
-  end
-
-  describe 'when calling the function has_key from a scope instance' do
-    it 'should detect existing keys' do
-      scope.function_has_key([{'one' => 1}, 'one']).should be_true
-    end
-
-    it 'should detect existing keys' do
-      scope.function_has_key([{'one' => 1}, 'two']).should be_false
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the hash function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("hash").should == "function_hash"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_hash([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert an array to a hash" do
-    result = scope.function_hash([['a',1,'b',2,'c',3]])
-    result.should(eq({'a'=>1,'b'=>2,'c'=>3}))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_array function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_array").should == "function_is_array"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_array([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if passed an array" do
-    result = scope.function_is_array([[1,2,3]])
-    result.should(eq(true))
-  end
-
-  it "should return false if passed a hash" do
-    result = scope.function_is_array([{'a'=>1}])
-    result.should(eq(false))
-  end
-
-  it "should return false if passed a string" do
-    result = scope.function_is_array(["asdf"])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_domain_name function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_domain_name").should == "function_is_domain_name"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_domain_name([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if a valid short domain name" do
-    result = scope.function_is_domain_name(["x.com"])
-    result.should(be_true)
-  end
-
-  it "should return true if the domain is ." do
-    result = scope.function_is_domain_name(["."])
-    result.should(be_true)
-  end
-
-  it "should return true if the domain is x.com." do
-    result = scope.function_is_domain_name(["x.com."])
-    result.should(be_true)
-  end
-
-  it "should return true if a valid domain name" do
-    result = scope.function_is_domain_name(["foo.bar.com"])
-    result.should(be_true)
-  end
-
-  it "should allow domain parts to start with numbers" do
-    result = scope.function_is_domain_name(["3foo.2bar.com"])
-    result.should(be_true)
-  end
-
-  it "should allow domain to end with a dot" do
-    result = scope.function_is_domain_name(["3foo.2bar.com."])
-    result.should(be_true)
-  end
-
-  it "should allow a single part domain" do
-    result = scope.function_is_domain_name(["orange"])
-    result.should(be_true)
-  end
-
-  it "should return false if domain parts start with hyphens" do
-    result = scope.function_is_domain_name(["-3foo.2bar.com"])
-    result.should(be_false)
-  end
-
-  it "should return true if domain contains hyphens" do
-    result = scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"])
-    result.should(be_true)
-  end
-
-  it "should return false if domain name contains spaces" do
-    result = scope.function_is_domain_name(["not valid"])
-    result.should(be_false)
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_float function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_float").should == "function_is_float"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_float([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if a float" do
-    result = scope.function_is_float(["0.12"])
-    result.should(eq(true))
-  end
-
-  it "should return false if a string" do
-    result = scope.function_is_float(["asdf"])
-    result.should(eq(false))
-  end
-
-  it "should return false if an integer" do
-    result = scope.function_is_float(["3"])
-    result.should(eq(false))
-  end
-  it "should return true if a float is created from an arithmetical operation" do
-    result = scope.function_is_float([3.2*2])
-    result.should(eq(true))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_function_available function" do
-  before :all do
-    Puppet::Parser::Functions.autoloader.loadall
-  end
-
-  before :each do
-    @scope = Puppet::Parser::Scope.new
-  end
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_function_available").should == "function_is_function_available"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { @scope.function_is_function_available([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return false if a nonexistent function is passed" do
-    result = @scope.function_is_function_available(['jeff_mccunes_left_sock'])
-    result.should(eq(false))
-  end
-
-  it "should return true if an available function is passed" do
-    result = @scope.function_is_function_available(['require'])
-    result.should(eq(true))
-  end
-
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_hash function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_hash").should == "function_is_hash"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_hash([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if passed a hash" do
-    result = scope.function_is_hash([{"a"=>1,"b"=>2}])
-    result.should(eq(true))
-  end
-
-  it "should return false if passed an array" do
-    result = scope.function_is_hash([["a","b"]])
-    result.should(eq(false))
-  end
-
-  it "should return false if passed a string" do
-    result = scope.function_is_hash(["asdf"])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_integer function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_integer").should == "function_is_integer"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if an integer" do
-    result = scope.function_is_integer(["3"])
-    result.should(eq(true))
-  end
-
-  it "should return false if a float" do
-    result = scope.function_is_integer(["3.2"])
-    result.should(eq(false))
-  end
-
-  it "should return false if a string" do
-    result = scope.function_is_integer(["asdf"])
-    result.should(eq(false))
-  end
-
-  it "should return true if an integer is created from an arithmetical operation" do
-    result = scope.function_is_integer([3*2])
-    result.should(eq(true))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_ip_address function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if an IPv4 address" do
-    result = scope.function_is_ip_address(["1.2.3.4"])
-    result.should(eq(true))
-  end
-
-  it "should return true if a full IPv6 address" do
-    result = scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
-    result.should(eq(true))
-  end
-
-  it "should return true if a compressed IPv6 address" do
-    result = scope.function_is_ip_address(["fe00::1"])
-    result.should(eq(true))
-  end
-
-  it "should return false if not valid" do
-    result = scope.function_is_ip_address(["asdf"])
-    result.should(eq(false))
-  end
-
-  it "should return false if IP octets out of range" do
-    result = scope.function_is_ip_address(["1.1.1.300"])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_mac_address function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if a valid mac address" do
-    result = scope.function_is_mac_address(["00:a0:1f:12:7f:a0"])
-    result.should(eq(true))
-  end
-
-  it "should return false if octets are out of range" do
-    result = scope.function_is_mac_address(["00:a0:1f:12:7f:g0"])
-    result.should(eq(false))
-  end
-
-  it "should return false if not valid" do
-    result = scope.function_is_mac_address(["not valid"])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_numeric function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_numeric").should == "function_is_numeric"
-  end
-
-  it "should raise a ParseError if there is less than 1 argument" do
-    lambda { scope.function_is_numeric([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if an integer" do
-    result = scope.function_is_numeric(["3"])
-    result.should(eq(true))
-  end
-
-  it "should return true if a float" do
-    result = scope.function_is_numeric(["3.2"])
-    result.should(eq(true))
-  end
-
-  it "should return true if an integer is created from an arithmetical operation" do
-    result = scope.function_is_numeric([3*2])
-    result.should(eq(true))
-  end
-
-  it "should return true if a float is created from an arithmetical operation" do
-    result = scope.function_is_numeric([3.2*2])
-    result.should(eq(true))
-  end
-
-  it "should return false if a string" do
-    result = scope.function_is_numeric(["asdf"])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the is_string function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("is_string").should == "function_is_string"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if a string" do
-    result = scope.function_is_string(["asdf"])
-    result.should(eq(true))
-  end
-
-  it "should return false if an integer" do
-    result = scope.function_is_string(["3"])
-    result.should(eq(false))
-  end
-
-  it "should return false if a float" do
-    result = scope.function_is_string(["3.23"])
-    result.should(eq(false))
-  end
-
-  it "should return false if an array" do
-    result = scope.function_is_string([["a","b","c"]])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the join_keys_to_values function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("join_keys_to_values").should == "function_join_keys_to_values"
-  end
-
-  it "should raise a ParseError if there are fewer than two arguments" do
-    lambda { scope.function_join_keys_to_values([{}]) }.should raise_error Puppet::ParseError
-  end
-
-  it "should raise a ParseError if there are greater than two arguments" do
-    lambda { scope.function_join_keys_to_values([{}, 'foo', 'bar']) }.should raise_error Puppet::ParseError
-  end
-
-  it "should raise a TypeError if the first argument is an array" do
-    lambda { scope.function_join_keys_to_values([[1,2], ',']) }.should raise_error TypeError
-  end
-
-  it "should raise a TypeError if the second argument is an array" do
-    lambda { scope.function_join_keys_to_values([{}, [1,2]]) }.should raise_error TypeError
-  end
-
-  it "should raise a TypeError if the second argument is a number" do
-    lambda { scope.function_join_keys_to_values([{}, 1]) }.should raise_error TypeError
-  end
-
-  it "should return an empty array given an empty hash" do
-    result = scope.function_join_keys_to_values([{}, ":"])
-    result.should == []
-  end
-
-  it "should join hash's keys to its values" do
-    result = scope.function_join_keys_to_values([{'a'=>1,2=>'foo',:b=>nil}, ":"])
-    result.should =~ ['a:1','2:foo','b:']
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the join function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("join").should == "function_join"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_join([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should join an array into a string" do
-    result = scope.function_join([["a","b","c"], ":"])
-    result.should(eq("a:b:c"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the keys function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("keys").should == "function_keys"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_keys([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return an array of keys when given a hash" do
-    result = scope.function_keys([{'a'=>1, 'b'=>2}])
-    # =~ performs 'array with same elements' (set) matching
-    # For more info see RSpec::Matchers::MatchArray
-    result.should =~ ['a','b']
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the lstrip function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("lstrip").should == "function_lstrip"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_lstrip([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should lstrip a string" do
-    result = scope.function_lstrip(["  asdf"])
-    result.should(eq('asdf'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the max function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("max").should == "function_max"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_max([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should be able to compare strings" do
-    scope.function_max(["albatross","dog","horse"]).should(eq("horse"))
-  end
-
-  it "should be able to compare numbers" do
-    scope.function_max([6,8,4]).should(eq(8))
-  end
-
-  it "should be able to compare a number with a stringified number" do
-    scope.function_max([1,"2"]).should(eq("2"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the member function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("member").should == "function_member"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_member([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if a member is in an array" do
-    result = scope.function_member([["a","b","c"], "a"])
-    result.should(eq(true))
-  end
-
-  it "should return false if a member is not in an array" do
-    result = scope.function_member([["a","b","c"], "d"])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:merge) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  describe 'when calling merge from puppet' do
-    it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = '$x = merge()'
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-
-    it "should not compile when 1 argument is passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
-      Puppet[:code] = "$my_hash={'one' => 1}\n$x = merge($my_hash)"
-      expect {
-        scope.compiler.compile
-      }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-  end
-
-  describe 'when calling merge on the scope instance' do
-    it 'should require all parameters are hashes' do
-      expect { new_hash = scope.function_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/)
-    end
-
-    it 'should be able to merge two hashes' do
-      new_hash = scope.function_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])
-      new_hash['one'].should   == '1'
-      new_hash['two'].should   == '2'
-      new_hash['three'].should == '2'
-    end
-
-    it 'should merge multiple hashes' do
-      hash = scope.function_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}])
-      hash['one'].should == '3'
-    end
-
-    it 'should accept empty hashes' do
-      scope.function_merge([{},{},{}]).should == {}
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the min function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("min").should == "function_min"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_min([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should be able to compare strings" do
-    scope.function_min(["albatross","dog","horse"]).should(eq("albatross"))
-  end
-
-  it "should be able to compare numbers" do
-    scope.function_min([6,8,4]).should(eq(4))
-  end
-
-  it "should be able to compare a number with a stringified number" do
-    scope.function_min([1,"2"]).should(eq(1))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the num2bool function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("num2bool").should == "function_num2bool"
-  end
-
-  it "should raise a ParseError if there are no arguments" do
-    lambda { scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a ParseError if there are more than 1 arguments" do
-    lambda { scope.function_num2bool(["foo","bar"]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a ParseError if passed something non-numeric" do
-    lambda { scope.function_num2bool(["xyzzy"]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return true if passed string 1" do
-    result = scope.function_num2bool(["1"])
-    result.should(be_true)
-  end
-
-  it "should return true if passed string 1.5" do
-    result = scope.function_num2bool(["1.5"])
-    result.should(be_true)
-  end
-
-  it "should return true if passed number 1" do
-    result = scope.function_num2bool([1])
-    result.should(be_true)
-  end
-
-  it "should return false if passed string 0" do
-    result = scope.function_num2bool(["0"])
-    result.should(be_false)
-  end
-
-  it "should return false if passed number 0" do
-    result = scope.function_num2bool([0])
-    result.should(be_false)
-  end
-
-  it "should return false if passed string -1" do
-    result = scope.function_num2bool(["-1"])
-    result.should(be_false)
-  end
-
-  it "should return false if passed string -1.5" do
-    result = scope.function_num2bool(["-1.5"])
-    result.should(be_false)
-  end
-
-  it "should return false if passed number -1" do
-    result = scope.function_num2bool([-1])
-    result.should(be_false)
-  end
-
-  it "should return false if passed float -1.5" do
-    result = scope.function_num2bool([-1.5])
-    result.should(be_false)
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the parsejson function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("parsejson").should == "function_parsejson"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert JSON to a data structure" do
-    json = <<-EOS
-["aaa","bbb","ccc"]
-EOS
-    result = scope.function_parsejson([json])
-    result.should(eq(['aaa','bbb','ccc']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the parseyaml function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert YAML to a data structure" do
-    yaml = <<-EOS
-- aaa
-- bbb
-- ccc
-EOS
-    result = scope.function_parseyaml([yaml])
-    result.should(eq(['aaa','bbb','ccc']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#!/usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the pick function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("pick").should == "function_pick"
-  end
-
-  it 'should return the correct value' do
-    scope.function_pick(['first', 'second']).should == 'first'
-  end
-
-  it 'should return the correct value if the first value is empty' do
-    scope.function_pick(['', 'second']).should == 'second'
-  end
-
-  it 'should remove empty string values' do
-    scope.function_pick(['', 'first']).should == 'first'
-  end
-
-  it 'should remove :undef values' do
-    scope.function_pick([:undef, 'first']).should == 'first'
-  end
-
-  it 'should remove :undefined values' do
-    scope.function_pick([:undefined, 'first']).should == 'first'
-  end
-
-  it 'should error if no values are passed' do
-    expect { scope.function_pick([]) }.to raise_error(Puppet::Error, /Must provide non empty value./)
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the prefix function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("prefix").should == "function_prefix"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_prefix([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return a prefixed array" do
-    result = scope.function_prefix([['a','b','c'], 'p'])
-    result.should(eq(['pa','pb','pc']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the range function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("range").should == "function_range"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_range([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return a letter range" do
-    result = scope.function_range(["a","d"])
-    result.should(eq(['a','b','c','d']))
-  end
-
-  it "should return a number range" do
-    result = scope.function_range(["1","4"])
-    result.should(eq([1,2,3,4]))
-  end
-
-  it "should work with padded hostname like strings" do
-    expected = ("host01".."host10").to_a
-    scope.function_range(["host01","host10"]).should eq expected
-  end
-
-  it "should coerce zero padded digits to integers" do
-    expected = (0..10).to_a
-    scope.function_range(["00", "10"]).should eq expected
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'spec_helper'
-
-describe "the reject function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("reject").should == "function_reject"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_reject([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should reject contents from an array" do
-    result = scope.function_reject([["1111", "aaabbb","bbbccc","dddeee"], "bbb"])
-    result.should(eq(["1111", "dddeee"]))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the reverse function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("reverse").should == "function_reverse"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_reverse([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should reverse a string" do
-    result = scope.function_reverse(["asdfghijkl"])
-    result.should(eq('lkjihgfdsa'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the rstrip function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("rstrip").should == "function_rstrip"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_rstrip([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should rstrip a string" do
-    result = scope.function_rstrip(["asdf  "])
-    result.should(eq('asdf'))
-  end
-
-  it "should rstrip each element in an array" do
-    result = scope.function_rstrip([["a ","b ", "c "]])
-    result.should(eq(['a','b','c']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the shuffle function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("shuffle").should == "function_shuffle"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should shuffle a string and the result should be the same size" do
-    result = scope.function_shuffle(["asdf"])
-    result.size.should(eq(4))
-  end
-
-  it "should shuffle a string but the sorted contents should still be the same" do
-    result = scope.function_shuffle(["adfs"])
-    result.split("").sort.join("").should(eq("adfs"))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the size function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("size").should == "function_size"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_size([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return the size of a string" do
-    result = scope.function_size(["asdf"])
-    result.should(eq(4))
-  end
-
-  it "should return the size of an array" do
-    result = scope.function_size([["a","b","c"]])
-    result.should(eq(3))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the sort function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("sort").should == "function_sort"
-  end
-
-  it "should raise a ParseError if there is not 1 arguments" do
-    lambda { scope.function_sort(['','']) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should sort an array" do
-    result = scope.function_sort([["a","c","b"]])
-    result.should(eq(['a','b','c']))
-  end
-
-  it "should sort a string" do
-    result = scope.function_sort(["acb"])
-    result.should(eq('abc'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the squeeze function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("squeeze").should == "function_squeeze"
-  end
-
-  it "should raise a ParseError if there is less than 2 arguments" do
-    lambda { scope.function_squeeze([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should squeeze a string" do
-    result = scope.function_squeeze(["aaabbbbcccc"])
-    result.should(eq('abc'))
-  end
-
-  it "should squeeze all elements in an array" do
-    result = scope.function_squeeze([["aaabbbbcccc","dddfff"]])
-    result.should(eq(['abc','df']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the str2bool function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("str2bool").should == "function_str2bool"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert string 'true' to true" do
-    result = scope.function_str2bool(["true"])
-    result.should(eq(true))
-  end
-
-  it "should convert string 'undef' to false" do
-    result = scope.function_str2bool(["undef"])
-    result.should(eq(false))
-  end
-  
-  it "should return the boolean it was called with" do
-    result = scope.function_str2bool([true])
-    result.should(eq(true))
-    result = scope.function_str2bool([false])
-    result.should(eq(false))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the str2saltedsha512 function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("str2saltedsha512").should == "function_str2saltedsha512"
-  end
-
-  it "should raise a ParseError if there is less than 1 argument" do
-    expect { scope.function_str2saltedsha512([]) }.to( raise_error(Puppet::ParseError) )
-  end
-
-  it "should raise a ParseError if there is more than 1 argument" do
-    expect { scope.function_str2saltedsha512(['foo', 'bar', 'baz']) }.to( raise_error(Puppet::ParseError) )
-  end
-
-  it "should return a salted-sha512 password hash 136 characters in length" do
-    result = scope.function_str2saltedsha512(["password"])
-    result.length.should(eq(136))
-  end
-
-  it "should raise an error if you pass a non-string password" do
-    expect { scope.function_str2saltedsha512([1234]) }.to( raise_error(Puppet::ParseError) )
-  end
-
-  it "should generate a valid password" do
-    # Allow the function to generate a password based on the string 'password'
-    password_hash = scope.function_str2saltedsha512(["password"])
-
-    # Separate the Salt and Password from the Password Hash
-    salt     = password_hash[0..7]
-    password = password_hash[8..-1]
-
-    # Convert the Salt and Password from Hex to Binary Data
-    str_salt     = Array(salt.lines).pack('H*')
-    str_password = Array(password.lines).pack('H*')
-
-    # Combine the Binary Salt with 'password' and compare the end result
-    saltedpass    = Digest::SHA512.digest(str_salt + 'password')
-    result        = (str_salt + saltedpass).unpack('H*')[0]
-    result.should == password_hash
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the strftime function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("strftime").should == "function_strftime"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_strftime([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "using %s should be higher then when I wrote this test" do
-    result = scope.function_strftime(["%s"])
-    result.to_i.should(be > 1311953157)
-  end
-
-  it "using %s should be lower then 1.5 trillion" do
-    result = scope.function_strftime(["%s"])
-    result.to_i.should(be < 1500000000)
-  end
-
-  it "should return a date when given %Y-%m-%d" do
-    result = scope.function_strftime(["%Y-%m-%d"])
-    result.should =~ /^\d{4}-\d{2}-\d{2}$/
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the strip function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  it "should exist" do
-    Puppet::Parser::Functions.function("strip").should == "function_strip"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_strip([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should strip a string" do
-    result = scope.function_strip([" ab cd "])
-    result.should(eq('ab cd'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the suffix function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("suffix").should == "function_suffix"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_suffix([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return a suffixed array" do
-    result = scope.function_suffix([['a','b','c'], 'p'])
-    result.should(eq(['ap','bp','cp']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the swapcase function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("swapcase").should == "function_swapcase"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_swapcase([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should swapcase a string" do
-    result = scope.function_swapcase(["aaBBccDD"])
-    result.should(eq('AAbbCCdd'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the time function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("time").should == "function_time"
-  end
-
-  it "should raise a ParseError if there is more than 2 arguments" do
-    lambda { scope.function_time(['','']) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return a number" do
-    result = scope.function_time([])
-    result.should be_an(Integer)
-  end
-
-  it "should be higher then when I wrote this test" do
-    result = scope.function_time([])
-    result.should(be > 1311953157)
-  end
-
-  it "should be lower then 1.5 trillion" do
-    result = scope.function_time([])
-    result.should(be < 1500000000)
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the to_bytes function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("to_bytes").should == "function_to_bytes"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_to_bytes([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should convert kB to B" do
-    result = scope.function_to_bytes(["4 kB"])
-    result.should(eq(4096))
-  end
-
-  it "should work without B in unit" do
-    result = scope.function_to_bytes(["4 k"])
-    result.should(eq(4096))
-  end
-
-  it "should work without a space before unit" do
-    result = scope.function_to_bytes(["4k"])
-    result.should(eq(4096))
-  end
-
-  it "should work without a unit" do
-    result = scope.function_to_bytes(["5678"])
-    result.should(eq(5678))
-  end
-
-  it "should convert fractions" do
-    result = scope.function_to_bytes(["1.5 kB"])
-    result.should(eq(1536))
-  end
-
-  it "should convert scientific notation" do
-    result = scope.function_to_bytes(["1.5e2 B"])
-    result.should(eq(150))
-  end
-
-  it "should do nothing with a positive number" do
-    result = scope.function_to_bytes([5678])
-    result.should(eq(5678))
-  end
-
-  it "should should raise a ParseError if input isn't a number" do
-    lambda { scope.function_to_bytes(["foo"]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should should raise a ParseError if prefix is unknown" do
-    lambda { scope.function_to_bytes(["5 uB"]) }.should( raise_error(Puppet::ParseError))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the type function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  it "should exist" do
-    Puppet::Parser::Functions.function("type").should == "function_type"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_type([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return string when given a string" do
-    result = scope.function_type(["aaabbbbcccc"])
-    result.should(eq('string'))
-  end
-
-  it "should return array when given an array" do
-    result = scope.function_type([["aaabbbbcccc","asdf"]])
-    result.should(eq('array'))
-  end
-
-  it "should return hash when given a hash" do
-    result = scope.function_type([{"a"=>1,"b"=>2}])
-    result.should(eq('hash'))
-  end
-
-  it "should return integer when given an integer" do
-    result = scope.function_type(["1"])
-    result.should(eq('integer'))
-  end
-
-  it "should return float when given a float" do
-    result = scope.function_type(["1.34"])
-    result.should(eq('float'))
-  end
-
-  it "should return boolean when given a boolean" do
-    result = scope.function_type([true])
-    result.should(eq('boolean'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the unique function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("unique").should == "function_unique"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_unique([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should remove duplicate elements in a string" do
-    result = scope.function_unique(["aabbc"])
-    result.should(eq('abc'))
-  end
-
-  it "should remove duplicate elements in an array" do
-    result = scope.function_unique([["a","a","b","b","c"]])
-    result.should(eq(['a','b','c']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the upcase function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("upcase").should == "function_upcase"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_upcase([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should upcase a string" do
-    result = scope.function_upcase(["abc"])
-    result.should(eq('ABC'))
-  end
-
-  it "should do nothing if a string is already upcase" do
-    result = scope.function_upcase(["ABC"])
-    result.should(eq('ABC'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the uriescape function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("uriescape").should == "function_uriescape"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_uriescape([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should uriescape a string" do
-    result = scope.function_uriescape([":/?#[]@!$&'()*+,;= "])
-    result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20'))
-  end
-
-  it "should do nothing if a string is already safe" do
-    result = scope.function_uriescape(["ABCdef"])
-    result.should(eq('ABCdef'))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_absolute_path) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  # The subject of these examples is the method itself.
-  subject do
-    # This makes sure the function is loaded within each test
-    function_name = Puppet::Parser::Functions.function(:validate_absolute_path)
-    scope.method(function_name)
-  end
-
-  describe "Valid Paths" do
-    def self.valid_paths
-      %w{
-        C:/
-        C:\\
-        C:\\WINDOWS\\System32
-        C:/windows/system32
-        X:/foo/bar
-        X:\\foo\\bar
-        /var/tmp
-        /var/lib/puppet
-        /var/opt/../lib/puppet
-      }
-    end
-
-    context "Without Puppet::Util.absolute_path? (e.g. Puppet <= 2.6)" do
-      before :each do
-        # The intent here is to mock Puppet to behave like Puppet 2.6 does.
-        # Puppet 2.6 does not have the absolute_path? method.  This is only a
-        # convenience test, stdlib should be run with the Puppet 2.6.x in the
-        # $LOAD_PATH in addition to 2.7.x and master.
-        Puppet::Util.expects(:respond_to?).with(:absolute_path?).returns(false)
-      end
-      valid_paths.each do |path|
-        it "validate_absolute_path(#{path.inspect}) should not fail" do
-          expect { subject.call [path] }.not_to raise_error Puppet::ParseError
-        end
-      end
-    end
-
-    context "Puppet without mocking" do
-      valid_paths.each do |path|
-        it "validate_absolute_path(#{path.inspect}) should not fail" do
-          expect { subject.call [path] }.not_to raise_error Puppet::ParseError
-        end
-      end
-    end
-  end
-
-  describe 'Invalid paths' do
-    context 'Garbage inputs' do
-      [
-        nil,
-        [ nil ],
-        { 'foo' => 'bar' },
-        { },
-        '',
-      ].each do |path|
-        it "validate_absolute_path(#{path.inspect}) should fail" do
-          expect { subject.call [path] }.to raise_error Puppet::ParseError
-        end
-      end
-    end
-
-    context 'Relative paths' do
-      %w{
-        relative1
-        .
-        ..
-        ./foo
-        ../foo
-        etc/puppetlabs/puppet
-        opt/puppet/bin
-      }.each do |path|
-        it "validate_absolute_path(#{path.inspect}) should fail" do
-          expect { subject.call [path] }.to raise_error Puppet::ParseError
-        end
-      end
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_array) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  describe 'when calling validate_array from puppet' do
-
-    %w{ true false }.each do |the_string|
-      it "should not compile when #{the_string} is a string" do
-        Puppet[:code] = "validate_array('#{the_string}')"
-        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
-      end
-
-      it "should not compile when #{the_string} is a bare word" do
-        Puppet[:code] = "validate_array(#{the_string})"
-        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
-      end
-    end
-
-    it "should compile when multiple array arguments are passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = [ ]
-        $bar = [ 'one', 'two' ]
-        validate_array($foo, $bar)
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-
-    it "should not compile when an undef variable is passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = undef
-        validate_array($foo)
-      ENDofPUPPETcode
-      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_augeas), :if => Puppet.features.augeas? do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  # The subject of these examplres is the method itself.
-  subject do
-    # This makes sure the function is loaded within each test
-    function_name = Puppet::Parser::Functions.function(:validate_augeas)
-    scope.method(function_name)
-  end
-
-  context 'Using Puppet::Parser::Scope.new' do
-
-    describe 'Garbage inputs' do
-      inputs = [
-        [ nil ],
-        [ [ nil ] ],
-        [ { 'foo' => 'bar' } ],
-        [ { } ],
-        [ '' ],
-        [ "one", "one", "MSG to User", "4th arg" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_augeas(#{input.inspect}) should fail" do
-          expect { subject.call [input] }.to raise_error Puppet::ParseError
-        end
-      end
-    end
-
-    describe 'Valid inputs' do
-      inputs = [
-        [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns' ],
-        [ "proc /proc   proc    nodev,noexec,nosuid     0       0\n", 'Fstab.lns'],
-      ]
-
-      inputs.each do |input|
-        it "validate_augeas(#{input.inspect}) should not fail" do
-          expect { subject.call input }.not_to raise_error
-        end
-      end
-    end
-
-    describe "Valid inputs which should raise an exception without a message" do
-      # The intent here is to make sure valid inputs raise exceptions when they
-      # don't specify an error message to display.  This is the behvior in
-      # 2.2.x and prior.
-      inputs = [
-        [ "root:x:0:0:root\n", 'Passwd.lns' ],
-        [ "127.0.1.1\n", 'Hosts.lns' ],
-      ]
-
-      inputs.each do |input|
-        it "validate_augeas(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /validate_augeas.*?matched less than it should/
-        end
-      end
-    end
-
-    describe "Nicer Error Messages" do
-      # The intent here is to make sure the function returns the 3rd argument
-      # in the exception thrown
-      inputs = [
-        [ "root:x:0:0:root\n", 'Passwd.lns', [], 'Failed to validate passwd content' ],
-        [ "127.0.1.1\n", 'Hosts.lns', [], 'Wrong hosts content' ],
-      ]
-
-      inputs.each do |input|
-        it "validate_augeas(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /#{input[2]}/
-        end
-      end
-    end
-
-    describe "Passing simple unit tests" do
-      inputs = [
-        [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']],
-        [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']],
-      ]
-
-      inputs.each do |input|
-        it "validate_augeas(#{input.inspect}) should fail" do
-          expect { subject.call input }.not_to raise_error
-        end
-      end
-    end
-
-    describe "Failing simple unit tests" do
-      inputs = [
-        [ "foobar:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']],
-        [ "root:x:0:0:root:/root:/bin/sh\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']],
-      ]
-
-      inputs.each do |input|
-        it "validate_augeas(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /testing path/
-        end
-      end
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#! /usr/bin/env/ruby -S rspec
-
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_bool) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-  describe 'when calling validate_bool from puppet' do
-
-    %w{ true false }.each do |the_string|
-
-      it "should not compile when #{the_string} is a string" do
-        Puppet[:code] = "validate_bool('#{the_string}')"
-        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
-      end
-
-      it "should compile when #{the_string} is a bare word" do
-        Puppet[:code] = "validate_bool(#{the_string})"
-        scope.compiler.compile
-      end
-
-    end
-
-    it "should not compile when an arbitrary string is passed" do
-      Puppet[:code] = 'validate_bool("jeff and dan are awesome")'
-      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
-    end
-
-    it "should not compile when no arguments are passed" do
-      Puppet[:code] = 'validate_bool()'
-      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
-    end
-
-    it "should compile when multiple boolean arguments are passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = true
-        $bar = false
-        validate_bool($foo, $bar, true, false)
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-
-    it "should compile when multiple boolean arguments are passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = true
-        $bar = false
-        validate_bool($foo, $bar, true, false, 'jeff')
-      ENDofPUPPETcode
-      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_cmd) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  # The subject of these examplres is the method itself.
-  subject do
-    # This makes sure the function is loaded within each test
-    function_name = Puppet::Parser::Functions.function(:validate_cmd)
-    scope.method(function_name)
-  end
-
-  context 'Using Puppet::Parser::Scope.new' do
-
-    describe 'Garbage inputs' do
-      inputs = [
-        [ nil ],
-        [ [ nil ] ],
-        [ { 'foo' => 'bar' } ],
-        [ { } ],
-        [ '' ],
-        [ "one", "one", "MSG to User", "4th arg" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_cmd(#{input.inspect}) should fail" do
-          expect { subject.call [input] }.to raise_error Puppet::ParseError
-        end
-      end
-    end
-
-    describe 'Valid inputs' do
-      inputs = [
-        [ '/full/path/to/something', '/bin/echo' ],
-        [ '/full/path/to/something', '/bin/cat' ],
-      ]
-
-      inputs.each do |input|
-        it "validate_cmd(#{input.inspect}) should not fail" do
-          expect { subject.call input }.not_to raise_error
-        end
-      end
-    end
-
-    describe "Valid inputs which should raise an exception without a message" do
-      # The intent here is to make sure valid inputs raise exceptions when they
-      # don't specify an error message to display.  This is the behvior in
-      # 2.2.x and prior.
-      inputs = [
-        [ "hello", "/bin/false" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_cmd(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /validate_cmd.*?failed to validate content with command/
-        end
-      end
-    end
-
-    describe "Nicer Error Messages" do
-      # The intent here is to make sure the function returns the 3rd argument
-      # in the exception thrown
-      inputs = [
-        [ "hello", [ "bye", "later", "adios" ], "MSG to User" ],
-        [ "greetings", "salutations", "Error, greetings does not match salutations" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_cmd(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /#{input[2]}/
-        end
-      end
-    end
-
-    describe "Test output message" do
-      it "validate_cmd('whatever', 'kthnksbye') should fail" do
-          expect { subject.call ['whatever', 'kthnksbye'] }.to raise_error /kthnksbye.* returned 1/
-      end
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_hash) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  describe 'when calling validate_hash from puppet' do
-
-    %w{ true false }.each do |the_string|
-
-      it "should not compile when #{the_string} is a string" do
-        Puppet[:code] = "validate_hash('#{the_string}')"
-        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
-      end
-
-      it "should not compile when #{the_string} is a bare word" do
-        Puppet[:code] = "validate_hash(#{the_string})"
-        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
-      end
-
-    end
-
-    it "should compile when multiple hash arguments are passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = {}
-        $bar = { 'one' => 'two' }
-        validate_hash($foo, $bar)
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-
-    it "should not compile when an undef variable is passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = undef
-        validate_hash($foo)
-      ENDofPUPPETcode
-      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
-    end
-
-  end
-
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_re) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  # The subject of these examplres is the method itself.
-  subject do
-    # This makes sure the function is loaded within each test
-    function_name = Puppet::Parser::Functions.function(:validate_re)
-    scope.method(function_name)
-  end
-
-  context 'Using Puppet::Parser::Scope.new' do
-
-    describe 'Garbage inputs' do
-      inputs = [
-        [ nil ],
-        [ [ nil ] ],
-        [ { 'foo' => 'bar' } ],
-        [ { } ],
-        [ '' ],
-        [ "one", "one", "MSG to User", "4th arg" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_re(#{input.inspect}) should fail" do
-          expect { subject.call [input] }.to raise_error Puppet::ParseError
-        end
-      end
-    end
-
-    describe 'Valid inputs' do
-      inputs = [
-        [ '/full/path/to/something', '^/full' ],
-        [ '/full/path/to/something', 'full' ],
-        [ '/full/path/to/something', ['full', 'absent'] ],
-        [ '/full/path/to/something', ['full', 'absent'], 'Message to the user' ],
-      ]
-
-      inputs.each do |input|
-        it "validate_re(#{input.inspect}) should not fail" do
-          expect { subject.call input }.not_to raise_error
-        end
-      end
-    end
-    describe "Valid inputs which should raise an exception without a message" do
-      # The intent here is to make sure valid inputs raise exceptions when they
-      # don't specify an error message to display.  This is the behvior in
-      # 2.2.x and prior.
-      inputs = [
-        [ "hello", [ "bye", "later", "adios" ] ],
-        [ "greetings", "salutations" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_re(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /validate_re.*?does not match/
-        end
-      end
-    end
-    describe "Nicer Error Messages" do
-      # The intent here is to make sure the function returns the 3rd argument
-      # in the exception thrown
-      inputs = [
-        [ "hello", [ "bye", "later", "adios" ], "MSG to User" ],
-        [ "greetings", "salutations", "Error, greetings does not match salutations" ],
-      ]
-
-      inputs.each do |input|
-        it "validate_re(#{input.inspect}) should fail" do
-          expect { subject.call input }.to raise_error /#{input[2]}/
-        end
-      end
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe "the validate_slength function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("validate_slength").should == "function_validate_slength"
-  end
-
-  it "should raise a ParseError if there is less than 2 arguments" do
-    expect { scope.function_validate_slength([]) }.to(raise_error(Puppet::ParseError))
-    expect { scope.function_validate_slength(["asdf"]) }.to(raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a ParseError if argument 2 doesn't convert to a fixnum" do
-    expect { scope.function_validate_slength(["moo",["2"]]) }.to(raise_error(Puppet::ParseError, /Couldn't convert whatever you passed/))
-  end
-
-  it "should raise a ParseError if argument 2 converted, but to 0, e.g. a string" do
-    expect { scope.function_validate_slength(["moo","monkey"]) }.to(raise_error(Puppet::ParseError, /please pass a positive number as max_length/))
-  end
-
-  it "should raise a ParseError if argument 2 converted, but to 0" do
-    expect { scope.function_validate_slength(["moo","0"]) }.to(raise_error(Puppet::ParseError, /please pass a positive number as max_length/))
-  end
-
-  it "should fail if string greater then size" do
-    expect { scope.function_validate_slength(["test", 2]) }.to(raise_error(Puppet::ParseError, /It should have been less than or equal to/))
-  end
-
-  it "should fail if you pass an array of something other than strings" do
-    expect { scope.function_validate_slength([["moo",["moo"],Hash.new["moo" => 7]], 7]) }.to(raise_error(Puppet::ParseError, /is not a string, it's a/))
-  end
-
-  it "should fail if you pass something other than a string or array" do
-    expect { scope.function_validate_slength([Hash.new["moo" => "7"],6]) }.to(raise_error(Puppet::ParseError), /please pass a string, or an array of strings/)
-  end
-
-  it "should not fail if string is smaller or equal to size" do
-    expect { scope.function_validate_slength(["test", 5]) }.to_not(raise_error(Puppet::ParseError))
-  end
-
-  it "should not fail if array of string is are all smaller or equal to size" do
-    expect { scope.function_validate_slength([["moo","foo","bar"], 5]) }.to_not(raise_error(Puppet::ParseError))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-
-require 'spec_helper'
-
-describe Puppet::Parser::Functions.function(:validate_string) do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  describe 'when calling validate_string from puppet' do
-
-    %w{ foo bar baz }.each do |the_string|
-
-      it "should compile when #{the_string} is a string" do
-        Puppet[:code] = "validate_string('#{the_string}')"
-        scope.compiler.compile
-      end
-
-      it "should compile when #{the_string} is a bare word" do
-        Puppet[:code] = "validate_string(#{the_string})"
-        scope.compiler.compile
-      end
-
-    end
-
-    %w{ true false }.each do |the_string|
-      it "should compile when #{the_string} is a string" do
-        Puppet[:code] = "validate_string('#{the_string}')"
-        scope.compiler.compile
-      end
-
-      it "should not compile when #{the_string} is a bare word" do
-        Puppet[:code] = "validate_string(#{the_string})"
-        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a string/)
-      end
-    end
-
-    it "should compile when multiple string arguments are passed" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = ''
-        $bar = 'two'
-        validate_string($foo, $bar)
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-
-    it "should compile when an explicitly undef variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        $foo = undef
-        validate_string($foo)
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-
-    it "should compile when an undefined variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do
-      Puppet[:code] = <<-'ENDofPUPPETcode'
-        validate_string($foobarbazishouldnotexist)
-      ENDofPUPPETcode
-      scope.compiler.compile
-    end
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the values_at function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("values_at").should == "function_values_at"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_values_at([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should raise a ParseError if you try to use a range where stop is greater then start" do
-    lambda { scope.function_values_at([['a','b'],["3-1"]]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return a value at from an array" do
-    result = scope.function_values_at([['a','b','c'],"1"])
-    result.should(eq(['b']))
-  end
-
-  it "should return a value at from an array when passed a range" do
-    result = scope.function_values_at([['a','b','c'],"0-1"])
-    result.should(eq(['a','b']))
-  end
-
-  it "should return chosen values from an array when passed number of indexes" do
-    result = scope.function_values_at([['a','b','c'],["0","2"]])
-    result.should(eq(['a','c']))
-  end
-
-  it "should return chosen values from an array when passed ranges and multiple indexes" do
-    result = scope.function_values_at([['a','b','c','d','e','f','g'],["0","2","4-5"]])
-    result.should(eq(['a','c','e','f']))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the values function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should exist" do
-    Puppet::Parser::Functions.function("values").should == "function_values"
-  end
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_values([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should return values from a hash" do
-    result = scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}])
-    # =~ is the RSpec::Matchers::MatchArray matcher.
-    # A.K.A. "array with same elements" (multiset) matching
-    result.should =~ %w{ 1 2 3 }
-  end
-
-  it "should return a multiset" do
-    result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}])
-    result.should     =~ %w{ 1 3 3 }
-    result.should_not =~ %w{ 1 3 }
-  end
-
-  it "should raise a ParseError unless a Hash is provided" do
-    lambda { scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#! /usr/bin/env ruby -S rspec
-require 'spec_helper'
-
-describe "the zip function" do
-  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
-
-  it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_zip([]) }.should( raise_error(Puppet::ParseError))
-  end
-
-  it "should be able to zip an array" do
-    result = scope.function_zip([['1','2','3'],['4','5','6']])
-    result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
-  end
-end
--- a/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,35 +1,39 @@
-require 'puppet'
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
 require 'tempfile'
 provider_class = Puppet::Type.type(:file_line).provider(:ruby)
 describe provider_class do
   context "when adding" do
-    before :each do
-      # TODO: these should be ported over to use the PuppetLabs spec_helper
-      #  file fixtures once the following pull request has been merged:
-      # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files
+    let :tmpfile do
       tmp = Tempfile.new('tmp')
-      @tmpfile = tmp.path
+      path = tmp.path
       tmp.close!
-      @resource = Puppet::Type::File_line.new(
-        {:name => 'foo', :path => @tmpfile, :line => 'foo'}
+      path
+    end
+    let :resource do
+      Puppet::Type::File_line.new(
+        {:name => 'foo', :path => tmpfile, :line => 'foo'}
       )
-      @provider = provider_class.new(@resource)
+    end
+    let :provider do
+      provider_class.new(resource)
     end
+
     it 'should detect if the line exists in the file' do
-      File.open(@tmpfile, 'w') do |fh|
+      File.open(tmpfile, 'w') do |fh|
         fh.write('foo')
       end
-      @provider.exists?.should be_true
+      expect(provider.exists?).to be_truthy
     end
     it 'should detect if the line does not exist in the file' do
-      File.open(@tmpfile, 'w') do |fh|
+      File.open(tmpfile, 'w') do |fh|
         fh.write('foo1')
       end
-      @provider.exists?.should be_nil
+      expect(provider.exists?).to be_nil
     end
     it 'should append to an existing file when creating' do
-      @provider.create
-      File.read(@tmpfile).chomp.should == 'foo'
+      provider.create
+      expect(File.read(tmpfile).chomp).to eq('foo')
     end
   end
 
@@ -52,38 +56,132 @@
       @provider = provider_class.new(@resource)
     end
 
-    it 'should raise an error if more than one line matches, and should not have modified the file' do
-      File.open(@tmpfile, 'w') do |fh|
-        fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz")
+    describe 'using match' do
+      it 'should raise an error if more than one line matches, and should not have modified the file' do
+        File.open(@tmpfile, 'w') do |fh|
+          fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz")
+        end
+        expect(@provider.exists?).to be_nil
+        expect { @provider.create }.to raise_error(Puppet::Error, /More than one line.*matches/)
+        expect(File.read(@tmpfile)).to eql("foo1\nfoo=blah\nfoo2\nfoo=baz")
+      end
+
+      it 'should replace all lines that matches' do
+        @resource = Puppet::Type::File_line.new(
+          {
+            :name => 'foo',
+            :path => @tmpfile,
+            :line => 'foo = bar',
+            :match => '^foo\s*=.*$',
+            :multiple => true
+          }
+        )
+        @provider = provider_class.new(@resource)
+        File.open(@tmpfile, 'w') do |fh|
+          fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz")
+        end
+        expect(@provider.exists?).to be_nil
+        @provider.create
+        expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2\nfoo = bar")
       end
-      @provider.exists?.should be_nil
-      expect { @provider.create }.to raise_error(Puppet::Error, /More than one line.*matches/)
-      File.read(@tmpfile).should eql("foo1\nfoo=blah\nfoo2\nfoo=baz")
+
+      it 'should raise an error with invalid values' do
+        expect {
+          @resource = Puppet::Type::File_line.new(
+            {
+              :name => 'foo',
+              :path => @tmpfile,
+              :line => 'foo = bar',
+              :match => '^foo\s*=.*$',
+              :multiple => 'asgadga'
+            }
+          )
+        }.to raise_error(Puppet::Error, /Invalid value "asgadga"\. Valid values are true, false\./)
+      end
+
+      it 'should replace a line that matches' do
+        File.open(@tmpfile, 'w') do |fh|
+          fh.write("foo1\nfoo=blah\nfoo2")
+        end
+        expect(@provider.exists?).to be_nil
+        @provider.create
+        expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2")
+      end
+      it 'should add a new line if no lines match' do
+        File.open(@tmpfile, 'w') do |fh|
+          fh.write("foo1\nfoo2")
+        end
+        expect(@provider.exists?).to be_nil
+        @provider.create
+        expect(File.read(@tmpfile)).to eql("foo1\nfoo2\nfoo = bar\n")
+      end
+      it 'should do nothing if the exact line already exists' do
+        File.open(@tmpfile, 'w') do |fh|
+          fh.write("foo1\nfoo = bar\nfoo2")
+        end
+        expect(@provider.exists?).to be_truthy
+        @provider.create
+        expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2")
+      end
     end
 
-    it 'should replace a line that matches' do
-      File.open(@tmpfile, 'w') do |fh|
-        fh.write("foo1\nfoo=blah\nfoo2")
+    describe 'using after' do
+      let :resource do
+        Puppet::Type::File_line.new(
+          {
+            :name  => 'foo',
+            :path  => @tmpfile,
+            :line  => 'inserted = line',
+            :after => '^foo1',
+          }
+        )
       end
-      @provider.exists?.should be_nil
-      @provider.create
-      File.read(@tmpfile).chomp.should eql("foo1\nfoo = bar\nfoo2")
-    end
-    it 'should add a new line if no lines match' do
-      File.open(@tmpfile, 'w') do |fh|
-        fh.write("foo1\nfoo2")
+
+      let :provider do
+        provider_class.new(resource)
+      end
+
+      context 'with one line matching the after expression' do
+        before :each do
+          File.open(@tmpfile, 'w') do |fh|
+            fh.write("foo1\nfoo = blah\nfoo2\nfoo = baz")
+          end
+        end
+
+        it 'inserts the specified line after the line matching the "after" expression' do
+          provider.create
+          expect(File.read(@tmpfile).chomp).to eql("foo1\ninserted = line\nfoo = blah\nfoo2\nfoo = baz")
+        end
       end
-      @provider.exists?.should be_nil
-      @provider.create
-      File.read(@tmpfile).should eql("foo1\nfoo2\nfoo = bar\n")
-    end
-    it 'should do nothing if the exact line already exists' do
-      File.open(@tmpfile, 'w') do |fh|
-        fh.write("foo1\nfoo = bar\nfoo2")
+
+      context 'with two lines matching the after expression' do
+        before :each do
+          File.open(@tmpfile, 'w') do |fh|
+            fh.write("foo1\nfoo = blah\nfoo2\nfoo1\nfoo = baz")
+          end
+        end
+
+        it 'errors out stating "One or no line must match the pattern"' do
+          expect { provider.create }.to raise_error(Puppet::Error, /One or no line must match the pattern/)
+        end
       end
-      @provider.exists?.should be_true
-      @provider.create
-      File.read(@tmpfile).chomp.should eql("foo1\nfoo = bar\nfoo2")
+
+      context 'with no lines matching the after expression' do
+        let :content do
+          "foo3\nfoo = blah\nfoo2\nfoo = baz\n"
+        end
+
+        before :each do
+          File.open(@tmpfile, 'w') do |fh|
+            fh.write(content)
+          end
+        end
+
+        it 'appends the specified line to the file' do
+          provider.create
+          expect(File.read(@tmpfile)).to eq(content << resource[:line] << "\n")
+        end
+      end
     end
   end
 
@@ -105,7 +203,7 @@
         fh.write("foo1\nfoo\nfoo2")
       end
       @provider.destroy
-      File.read(@tmpfile).should eql("foo1\nfoo2")
+      expect(File.read(@tmpfile)).to eql("foo1\nfoo2")
     end
 
     it 'should remove the line without touching the last new line' do
@@ -113,7 +211,7 @@
         fh.write("foo1\nfoo\nfoo2\n")
       end
       @provider.destroy
-      File.read(@tmpfile).should eql("foo1\nfoo2\n")
+      expect(File.read(@tmpfile)).to eql("foo1\nfoo2\n")
     end
 
     it 'should remove any occurence of the line' do
@@ -121,7 +219,7 @@
         fh.write("foo1\nfoo\nfoo2\nfoo\nfoo")
       end
       @provider.destroy
-      File.read(@tmpfile).should eql("foo1\nfoo2\n")
+      expect(File.read(@tmpfile)).to eql("foo1\nfoo2\n")
     end
   end
 end
--- a/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,11 +1,11 @@
 #!/usr/bin/env ruby
 
-require 'puppet'
+require 'spec_helper'
 
 anchor = Puppet::Type.type(:anchor).new(:name => "ntp::begin")
 
 describe anchor do
   it "should stringify normally" do
-    anchor.to_s.should == "Anchor[ntp::begin]"
+    expect(anchor.to_s).to eq("Anchor[ntp::begin]")
   end
 end
--- a/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb	Sat Mar 14 20:07:04 2015 +0000
+++ b/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb	Sat Mar 14 20:09:45 2015 +0000
@@ -1,4 +1,5 @@
-require 'puppet'
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
 require 'tempfile'
 describe Puppet::Type.type(:file_line) do
   let :file_line do
@@ -6,22 +7,22 @@
   end
   it 'should accept a line and path' do
     file_line[:line] = 'my_line'
-    file_line[:line].should == 'my_line'
+    expect(file_line[:line]).to eq('my_line')
     file_line[:path] = '/my/path'
-    file_line[:path].should == '/my/path'
+    expect(file_line[:path]).to eq('/my/path')
   end
   it 'should accept a match regex' do
     file_line[:match] = '^foo.*$'
-    file_line[:match].should == '^foo.*$'
+    expect(file_line[:match]).to eq('^foo.*$')
   end
-  it 'should not accept a match regex that does not match the specified line' do
+  it 'should accept a match regex that does not match the specified line' do
     expect {
       Puppet::Type.type(:file_line).new(
           :name   => 'foo',
           :path   => '/my/path',
           :line   => 'foo=bar',
           :match  => '^bar=blah$'
-    )}.to raise_error(Puppet::Error, /the value must be a regex that matches/)
+    )}.not_to raise_error
   end
   it 'should accept a match regex that does match the specified line' do
     expect {
@@ -34,7 +35,7 @@
   end
   it 'should accept posix filenames' do
     file_line[:path] = '/tmp/path'
-    file_line[:path].should == '/tmp/path'
+    expect(file_line[:path]).to eq('/tmp/path')
   end
   it 'should not accept unqualified path' do
     expect { file_line[:path] = 'file' }.to raise_error(Puppet::Error, /File paths must be fully qualified/)
@@ -46,7 +47,7 @@
     expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /Both line and path are required attributes/)
   end
   it 'should default to ensure => present' do
-    file_line[:ensure].should eq :present
+    expect(file_line[:ensure]).to eq :present
   end
 
   it "should autorequire the file it manages" do
@@ -58,12 +59,12 @@
     relationship = file_line.autorequire.find do |rel|
       (rel.source.to_s == "File[/tmp/path]") and (rel.target.to_s == file_line.to_s)
     end
-    relationship.should be_a Puppet::Relationship
+    expect(relationship).to be_a Puppet::Relationship
   end
 
   it "should not autorequire the file it manages if it is not managed" do
     catalog = Puppet::Resource::Catalog.new
     catalog.add_resource file_line
-    file_line.autorequire.should be_empty
+    expect(file_line.autorequire).to be_empty
   end
 end
--- a/modules/stdlib/spec/watchr.rb	Sat Mar 14 20:07:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-ENV['FOG_MOCK'] ||= 'true'
-ENV['AUTOTEST'] = 'true'
-ENV['WATCHR']   = '1'
-
-system 'clear'
-
-def growl(message)
-  growlnotify = `which growlnotify`.chomp
-  title = "Watchr Test Results"
-  image = case message
-  when /(\d+)\s+?(failure|error)/i
-    ($1.to_i == 0) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
-  else
-    '~/.watchr_images/unknown.png'
-  end
-  options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
-  system %(#{growlnotify} #{options} &)
-end
-
-def run(cmd)
-  puts(cmd)
-  `#{cmd}`
-end
-
-def run_spec_test(file)
-  if File.exist? file
-    result = run "rspec --format p --color #{file}"
-    growl result.split("\n").last
-    puts result
-  else
-    puts "FIXME: No test #{file} [#{Time.now}]"
-  end
-end
-
-def filter_rspec(data)
-  data.split("\n").find_all do |l|
-    l =~ /^(\d+)\s+exampl\w+.*?(\d+).*?failur\w+.*?(\d+).*?pending/
-  end.join("\n")
-end
-
-def run_all_tests
-  system('clear')
-  files = Dir.glob("spec/**/*_spec.rb").join(" ")
-  result = run "rspec #{files}"
-  growl_results = filter_rspec result
-  growl growl_results
-  puts result
-  puts "GROWL: #{growl_results}"
-end
-
-# Ctrl-\
-Signal.trap 'QUIT' do
-  puts " --- Running all tests ---\n\n"
-  run_all_tests
-end
-
-@interrupted = false
-
-# Ctrl-C
-Signal.trap 'INT' do
-  if @interrupted then
-    @wants_to_quit = true
-    abort("\n")
-  else
-    puts "Interrupt a second time to quit"
-    @interrupted = true
-    Kernel.sleep 1.5
-    # raise Interrupt, nil # let the run loop catch it
-    run_suite
-  end
-end
-
-def file2spec(file)
-  result = file.sub('lib/puppet/', 'spec/unit/puppet/').gsub(/\.rb$/, '_spec.rb')
-  result = file.sub('lib/facter/', 'spec/unit/facter/').gsub(/\.rb$/, '_spec.rb')
-end
-
-
-watch( 'spec/.*_spec\.rb' ) do |md|
-  #run_spec_test(md[0])
-  run_all_tests
-end
-watch( 'lib/.*\.rb' ) do |md|
-  # run_spec_test(file2spec(md[0]))
-  run_all_tests
-end