summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/acceptance/abs_spec.rb30
-rwxr-xr-xspec/acceptance/any2array_spec.rb49
-rwxr-xr-xspec/acceptance/base64_spec.rb18
-rwxr-xr-xspec/acceptance/bool2num_spec.rb34
-rwxr-xr-xspec/acceptance/build_csv.rb83
-rwxr-xr-xspec/acceptance/capitalize_spec.rb33
-rwxr-xr-xspec/acceptance/chomp_spec.rb21
-rwxr-xr-xspec/acceptance/chop_spec.rb45
-rwxr-xr-xspec/acceptance/concat_spec.rb18
-rwxr-xr-xspec/acceptance/count_spec.rb30
-rwxr-xr-xspec/acceptance/deep_merge_spec.rb20
-rwxr-xr-xspec/acceptance/defined_with_params_spec.rb22
-rwxr-xr-xspec/acceptance/delete_at_spec.rb19
-rwxr-xr-xspec/acceptance/delete_spec.rb19
-rwxr-xr-xspec/acceptance/delete_undef_values_spec.rb19
-rwxr-xr-xspec/acceptance/delete_values_spec.rb25
-rwxr-xr-xspec/acceptance/difference_spec.rb26
-rwxr-xr-xspec/acceptance/dirname_spec.rb42
-rwxr-xr-xspec/acceptance/downcase_spec.rb39
-rwxr-xr-xspec/acceptance/empty_spec.rb39
-rwxr-xr-xspec/acceptance/ensure_packages_spec.rb24
-rwxr-xr-xspec/acceptance/ensure_resource_spec.rb24
-rwxr-xr-xspec/acceptance/flatten_spec.rb39
-rwxr-xr-xspec/acceptance/floor_spec.rb39
-rwxr-xr-xspec/acceptance/fqdn_rotate_spec.rb33
-rwxr-xr-xspec/acceptance/get_module_path_spec.rb41
-rwxr-xr-xspec/acceptance/getparam_spec.rb25
-rwxr-xr-xspec/acceptance/getvar_spec.rb26
-rwxr-xr-xspec/acceptance/grep_spec.rb26
-rwxr-xr-xspec/acceptance/has_interface_with_spec.rb44
-rwxr-xr-xspec/acceptance/has_ip_address_spec.rb33
-rwxr-xr-xspec/acceptance/has_ip_network_spec.rb33
-rwxr-xr-xspec/acceptance/has_key_spec.rb41
-rwxr-xr-xspec/acceptance/hash_spec.rb26
-rwxr-xr-xspec/acceptance/intersection_spec.rb27
-rwxr-xr-xspec/acceptance/is_array_spec.rb67
-rwxr-xr-xspec/acceptance/is_bool_spec.rb81
-rwxr-xr-xspec/acceptance/is_domain_name_spec.rb83
-rwxr-xr-xspec/acceptance/is_float_spec.rb86
-rwxr-xr-xspec/acceptance/is_function_available_spec.rb58
-rwxr-xr-xspec/acceptance/is_hash_spec.rb63
-rwxr-xr-xspec/acceptance/is_integer_spec.rb95
-rwxr-xr-xspec/acceptance/is_ip_address_spec.rb80
-rwxr-xr-xspec/acceptance/is_mac_address_spec.rb38
-rwxr-xr-xspec/acceptance/is_numeric_spec.rb95
-rwxr-xr-xspec/acceptance/is_string_spec.rb102
-rwxr-xr-xspec/acceptance/join_keys_to_values_spec.rb24
-rwxr-xr-xspec/acceptance/join_spec.rb26
-rwxr-xr-xspec/acceptance/keys_spec.rb23
-rw-r--r--spec/acceptance/loadyaml_spec.rb31
-rwxr-xr-xspec/acceptance/lstrip_spec.rb34
-rwxr-xr-xspec/acceptance/max_spec.rb20
-rwxr-xr-xspec/acceptance/member_spec.rb26
-rwxr-xr-xspec/acceptance/merge_spec.rb23
-rwxr-xr-xspec/acceptance/min_spec.rb20
-rw-r--r--spec/acceptance/nodesets/centos-6-vcloud.yml15
-rw-r--r--spec/acceptance/nodesets/centos-65-x64.yml10
-rw-r--r--[l---------]spec/acceptance/nodesets/default.yml11
-rwxr-xr-xspec/acceptance/num2bool_spec.rb76
-rwxr-xr-xspec/acceptance/parsejson_spec.rb34
-rwxr-xr-xspec/acceptance/parseyaml_spec.rb35
-rwxr-xr-xspec/acceptance/pick_default_spec.rb54
-rwxr-xr-xspec/acceptance/pick_spec.rb44
-rwxr-xr-xspec/acceptance/prefix_spec.rb42
-rwxr-xr-xspec/acceptance/range_spec.rb36
-rwxr-xr-xspec/acceptance/reject_spec.rb42
-rwxr-xr-xspec/acceptance/reverse_spec.rb23
-rwxr-xr-xspec/acceptance/rstrip_spec.rb34
-rwxr-xr-xspec/acceptance/shuffle_spec.rb34
-rwxr-xr-xspec/acceptance/size_spec.rb55
-rwxr-xr-xspec/acceptance/sort_spec.rb34
-rwxr-xr-xspec/acceptance/squeeze_spec.rb47
-rwxr-xr-xspec/acceptance/str2bool_spec.rb31
-rwxr-xr-xspec/acceptance/str2saltedsha512_spec.rb22
-rwxr-xr-xspec/acceptance/strftime_spec.rb22
-rwxr-xr-xspec/acceptance/strip_spec.rb34
-rwxr-xr-xspec/acceptance/suffix_spec.rb42
-rwxr-xr-xspec/acceptance/swapcase_spec.rb22
-rwxr-xr-xspec/acceptance/time_spec.rb36
-rwxr-xr-xspec/acceptance/to_bytes_spec.rb27
-rwxr-xr-xspec/acceptance/type_spec.rb37
-rwxr-xr-xspec/acceptance/union_spec.rb24
-rwxr-xr-xspec/acceptance/unique_spec.rb33
-rwxr-xr-x[-rw-r--r--]spec/acceptance/unsupported_spec.rb1
-rwxr-xr-xspec/acceptance/upcase_spec.rb33
-rwxr-xr-xspec/acceptance/uriescape_spec.rb23
-rwxr-xr-xspec/acceptance/validate_absolute_path_spec.rb31
-rwxr-xr-xspec/acceptance/validate_array_spec.rb37
-rwxr-xr-xspec/acceptance/validate_augeas_spec.rb63
-rwxr-xr-xspec/acceptance/validate_bool_spec.rb37
-rwxr-xr-xspec/acceptance/validate_cmd_spec.rb50
-rwxr-xr-xspec/acceptance/validate_hash_spec.rb37
-rwxr-xr-xspec/acceptance/validate_ipv4_address_spec.rb31
-rwxr-xr-xspec/acceptance/validate_ipv6_address_spec.rb31
-rwxr-xr-xspec/acceptance/validate_re_spec.rb47
-rwxr-xr-xspec/acceptance/validate_slength_spec.rb72
-rwxr-xr-xspec/acceptance/validate_string_spec.rb36
-rwxr-xr-xspec/acceptance/values_at_spec.rb73
-rwxr-xr-xspec/acceptance/values_spec.rb31
-rwxr-xr-xspec/acceptance/zip_spec.rb74
-rwxr-xr-x[-rw-r--r--]spec/classes/anchor_spec.rb1
-rwxr-xr-xspec/functions/abs_spec.rb (renamed from spec/unit/puppet/parser/functions/abs_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/any2array_spec.rb (renamed from spec/unit/puppet/parser/functions/any2array_spec.rb)0
-rwxr-xr-xspec/functions/base64_spec.rb (renamed from spec/unit/puppet/parser/functions/base64_spec.rb)0
-rwxr-xr-xspec/functions/bool2num_spec.rb (renamed from spec/unit/puppet/parser/functions/bool2num_spec.rb)0
-rwxr-xr-xspec/functions/capitalize_spec.rb (renamed from spec/unit/puppet/parser/functions/capitalize_spec.rb)0
-rwxr-xr-xspec/functions/chomp_spec.rb (renamed from spec/unit/puppet/parser/functions/chomp_spec.rb)0
-rwxr-xr-xspec/functions/chop_spec.rb (renamed from spec/unit/puppet/parser/functions/chop_spec.rb)0
-rwxr-xr-xspec/functions/concat_spec.rb30
-rwxr-xr-x[-rw-r--r--]spec/functions/count_spec.rb (renamed from spec/unit/puppet/parser/functions/count_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/deep_merge_spec.rb (renamed from spec/unit/puppet/parser/functions/deep_merge_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/defined_with_params_spec.rb0
-rwxr-xr-xspec/functions/delete_at_spec.rb (renamed from spec/unit/puppet/parser/functions/delete_at_spec.rb)0
-rwxr-xr-xspec/functions/delete_spec.rb (renamed from spec/unit/puppet/parser/functions/delete_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/delete_undef_values_spec.rb (renamed from spec/unit/puppet/parser/functions/delete_undef_values_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/delete_values_spec.rb (renamed from spec/unit/puppet/parser/functions/delete_values_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/difference_spec.rb (renamed from spec/unit/puppet/parser/functions/difference_spec.rb)0
-rwxr-xr-xspec/functions/dirname_spec.rb (renamed from spec/unit/puppet/parser/functions/dirname_spec.rb)0
-rwxr-xr-xspec/functions/downcase_spec.rb (renamed from spec/unit/puppet/parser/functions/downcase_spec.rb)0
-rwxr-xr-xspec/functions/empty_spec.rb (renamed from spec/unit/puppet/parser/functions/empty_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/ensure_packages_spec.rb13
-rwxr-xr-x[-rw-r--r--]spec/functions/ensure_resource_spec.rb1
-rwxr-xr-xspec/functions/flatten_spec.rb (renamed from spec/unit/puppet/parser/functions/flatten_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/floor_spec.rb (renamed from spec/unit/puppet/parser/functions/floor_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/fqdn_rotate_spec.rb (renamed from spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/get_module_path_spec.rb (renamed from spec/unit/puppet/parser/functions/get_module_path_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/getparam_spec.rb1
-rwxr-xr-x[-rw-r--r--]spec/functions/getvar_spec.rb (renamed from spec/unit/puppet/parser/functions/getvar_spec.rb)0
-rwxr-xr-xspec/functions/grep_spec.rb (renamed from spec/unit/puppet/parser/functions/grep_spec.rb)0
-rwxr-xr-xspec/functions/has_interface_with_spec.rb (renamed from spec/unit/puppet/parser/functions/has_interface_with_spec.rb)0
-rwxr-xr-xspec/functions/has_ip_address_spec.rb (renamed from spec/unit/puppet/parser/functions/has_ip_address_spec.rb)0
-rwxr-xr-xspec/functions/has_ip_network_spec.rb (renamed from spec/unit/puppet/parser/functions/has_ip_network_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/has_key_spec.rb (renamed from spec/unit/puppet/parser/functions/has_key_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/hash_spec.rb (renamed from spec/unit/puppet/parser/functions/hash_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/intersection_spec.rb (renamed from spec/unit/puppet/parser/functions/intersection_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_array_spec.rb (renamed from spec/unit/puppet/parser/functions/is_array_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_bool_spec.rb (renamed from spec/unit/puppet/parser/functions/is_bool_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_domain_name_spec.rb (renamed from spec/unit/puppet/parser/functions/is_domain_name_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_float_spec.rb (renamed from spec/unit/puppet/parser/functions/is_float_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_function_available.rb (renamed from spec/unit/puppet/parser/functions/is_function_available.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_hash_spec.rb (renamed from spec/unit/puppet/parser/functions/is_hash_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_integer_spec.rb (renamed from spec/unit/puppet/parser/functions/is_integer_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_ip_address_spec.rb (renamed from spec/unit/puppet/parser/functions/is_ip_address_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_mac_address_spec.rb (renamed from spec/unit/puppet/parser/functions/is_mac_address_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_numeric_spec.rb (renamed from spec/unit/puppet/parser/functions/is_numeric_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/is_string_spec.rb (renamed from spec/unit/puppet/parser/functions/is_string_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/join_keys_to_values_spec.rb (renamed from spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/join_spec.rb (renamed from spec/unit/puppet/parser/functions/join_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/keys_spec.rb (renamed from spec/unit/puppet/parser/functions/keys_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/loadyaml_spec.rb (renamed from spec/unit/puppet/parser/functions/loadyaml_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/lstrip_spec.rb (renamed from spec/unit/puppet/parser/functions/lstrip_spec.rb)0
-rwxr-xr-xspec/functions/max_spec.rb (renamed from spec/unit/puppet/parser/functions/max_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/member_spec.rb (renamed from spec/unit/puppet/parser/functions/member_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/merge_spec.rb (renamed from spec/unit/puppet/parser/functions/merge_spec.rb)0
-rwxr-xr-xspec/functions/min_spec.rb (renamed from spec/unit/puppet/parser/functions/min_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/num2bool_spec.rb (renamed from spec/unit/puppet/parser/functions/num2bool_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/parsejson_spec.rb (renamed from spec/unit/puppet/parser/functions/parsejson_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/parseyaml_spec.rb (renamed from spec/unit/puppet/parser/functions/parseyaml_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/pick_default_spec.rb (renamed from spec/unit/puppet/parser/functions/pick_default_spec.rb)0
-rwxr-xr-xspec/functions/pick_spec.rb (renamed from spec/unit/puppet/parser/functions/pick_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/prefix_spec.rb (renamed from spec/unit/puppet/parser/functions/prefix_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/range_spec.rb (renamed from spec/unit/puppet/parser/functions/range_spec.rb)0
-rwxr-xr-xspec/functions/reject_spec.rb (renamed from spec/unit/puppet/parser/functions/reject_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/reverse_spec.rb (renamed from spec/unit/puppet/parser/functions/reverse_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/rstrip_spec.rb (renamed from spec/unit/puppet/parser/functions/rstrip_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/shuffle_spec.rb (renamed from spec/unit/puppet/parser/functions/shuffle_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/size_spec.rb (renamed from spec/unit/puppet/parser/functions/size_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/sort_spec.rb (renamed from spec/unit/puppet/parser/functions/sort_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/squeeze_spec.rb (renamed from spec/unit/puppet/parser/functions/squeeze_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/str2bool_spec.rb (renamed from spec/unit/puppet/parser/functions/str2bool_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/str2saltedsha512_spec.rb (renamed from spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/strftime_spec.rb (renamed from spec/unit/puppet/parser/functions/strftime_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/strip_spec.rb (renamed from spec/unit/puppet/parser/functions/strip_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/suffix_spec.rb (renamed from spec/unit/puppet/parser/functions/suffix_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/swapcase_spec.rb (renamed from spec/unit/puppet/parser/functions/swapcase_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/time_spec.rb (renamed from spec/unit/puppet/parser/functions/time_spec.rb)0
-rwxr-xr-xspec/functions/to_bytes_spec.rb (renamed from spec/unit/puppet/parser/functions/to_bytes_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/type_spec.rb (renamed from spec/unit/puppet/parser/functions/type_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/union_spec.rb (renamed from spec/unit/puppet/parser/functions/union_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/unique_spec.rb (renamed from spec/unit/puppet/parser/functions/unique_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/upcase_spec.rb (renamed from spec/unit/puppet/parser/functions/upcase_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/uriescape_spec.rb (renamed from spec/unit/puppet/parser/functions/uriescape_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_absolute_path_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb)1
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_array_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_array_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_augeas_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_augeas_spec.rb)1
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_bool_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_bool_spec.rb)2
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_cmd_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_cmd_spec.rb)1
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_hash_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_hash_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_ipv4_address_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_ipv4_address_spec.rb)2
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_ipv6_address_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_ipv6_address_spec.rb)2
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_re_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_re_spec.rb)1
-rwxr-xr-xspec/functions/validate_slength_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_slength_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/validate_string_spec.rb (renamed from spec/unit/puppet/parser/functions/validate_string_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/values_at_spec.rb (renamed from spec/unit/puppet/parser/functions/values_at_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/values_spec.rb (renamed from spec/unit/puppet/parser/functions/values_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/functions/zip_spec.rb (renamed from spec/unit/puppet/parser/functions/zip_spec.rb)0
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/compiler.rb1
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/database.rb1
-rwxr-xr-xspec/lib/puppet_spec/files.rb1
-rwxr-xr-xspec/lib/puppet_spec/fixtures.rb1
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/matchers.rb1
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/modules.rb1
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/pops.rb1
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/scope.rb1
-rwxr-xr-x[-rw-r--r--]spec/lib/puppet_spec/settings.rb1
-rwxr-xr-xspec/lib/puppet_spec/verbose.rb1
-rwxr-xr-xspec/monkey_patches/alias_should_to_must.rb1
-rwxr-xr-xspec/monkey_patches/publicize_methods.rb1
-rwxr-xr-x[-rw-r--r--]spec/spec_helper.rb1
-rwxr-xr-x[-rw-r--r--]spec/spec_helper_acceptance.rb24
-rwxr-xr-xspec/unit/facter/facter_dot_d_spec.rb32
-rw-r--r--spec/unit/facter/pe_required_facts_spec.rb70
-rwxr-xr-x[-rw-r--r--]spec/unit/facter/pe_version_spec.rb0
-rwxr-xr-x[-rw-r--r--]spec/unit/facter/root_home_spec.rb1
-rwxr-xr-x[-rw-r--r--]spec/unit/facter/util/puppet_settings_spec.rb1
-rw-r--r--spec/unit/puppet/parser/functions/concat_spec.rb15
-rwxr-xr-x[-rw-r--r--]spec/unit/puppet/provider/file_line/ruby_spec.rb1
-rwxr-xr-x[-rw-r--r--]spec/unit/puppet/type/anchor_spec.rb0
-rwxr-xr-x[-rw-r--r--]spec/unit/puppet/type/file_line_spec.rb1
219 files changed, 3951 insertions, 113 deletions
diff --git a/spec/acceptance/abs_spec.rb b/spec/acceptance/abs_spec.rb
new file mode 100755
index 0000000..8e05642
--- /dev/null
+++ b/spec/acceptance/abs_spec.rb
@@ -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
diff --git a/spec/acceptance/any2array_spec.rb b/spec/acceptance/any2array_spec.rb
new file mode 100755
index 0000000..467d6af
--- /dev/null
+++ b/spec/acceptance/any2array_spec.rb
@@ -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: testarray/)
+ 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: testarray/)
+ end
+ end
+ end
+end
diff --git a/spec/acceptance/base64_spec.rb b/spec/acceptance/base64_spec.rb
new file mode 100755
index 0000000..97e1738
--- /dev/null
+++ b/spec/acceptance/base64_spec.rb
@@ -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
diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb
new file mode 100755
index 0000000..7a70311
--- /dev/null
+++ b/spec/acceptance/bool2num_spec.rb
@@ -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
diff --git a/spec/acceptance/build_csv.rb b/spec/acceptance/build_csv.rb
new file mode 100755
index 0000000..62ecbf1
--- /dev/null
+++ b/spec/acceptance/build_csv.rb
@@ -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
diff --git a/spec/acceptance/capitalize_spec.rb b/spec/acceptance/capitalize_spec.rb
new file mode 100755
index 0000000..e5e7b7b
--- /dev/null
+++ b/spec/acceptance/capitalize_spec.rb
@@ -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
diff --git a/spec/acceptance/chomp_spec.rb b/spec/acceptance/chomp_spec.rb
new file mode 100755
index 0000000..f6c1595
--- /dev/null
+++ b/spec/acceptance/chomp_spec.rb
@@ -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
diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb
new file mode 100755
index 0000000..dbc28da
--- /dev/null
+++ b/spec/acceptance/chop_spec.rb
@@ -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
diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb
new file mode 100755
index 0000000..7bda365
--- /dev/null
+++ b/spec/acceptance/concat_spec.rb
@@ -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
diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb
new file mode 100755
index 0000000..51a40ba
--- /dev/null
+++ b/spec/acceptance/count_spec.rb
@@ -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
diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb
new file mode 100755
index 0000000..c0f9b12
--- /dev/null
+++ b/spec/acceptance/deep_merge_spec.rb
@@ -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
diff --git a/spec/acceptance/defined_with_params_spec.rb b/spec/acceptance/defined_with_params_spec.rb
new file mode 100755
index 0000000..fc54450
--- /dev/null
+++ b/spec/acceptance/defined_with_params_spec.rb
@@ -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
diff --git a/spec/acceptance/delete_at_spec.rb b/spec/acceptance/delete_at_spec.rb
new file mode 100755
index 0000000..db0c01f
--- /dev/null
+++ b/spec/acceptance/delete_at_spec.rb
@@ -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
diff --git a/spec/acceptance/delete_spec.rb b/spec/acceptance/delete_spec.rb
new file mode 100755
index 0000000..a28604c
--- /dev/null
+++ b/spec/acceptance/delete_spec.rb
@@ -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
diff --git a/spec/acceptance/delete_undef_values_spec.rb b/spec/acceptance/delete_undef_values_spec.rb
new file mode 100755
index 0000000..b7eda19
--- /dev/null
+++ b/spec/acceptance/delete_undef_values_spec.rb
@@ -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
diff --git a/spec/acceptance/delete_values_spec.rb b/spec/acceptance/delete_values_spec.rb
new file mode 100755
index 0000000..6d2369c
--- /dev/null
+++ b/spec/acceptance/delete_values_spec.rb
@@ -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
diff --git a/spec/acceptance/difference_spec.rb b/spec/acceptance/difference_spec.rb
new file mode 100755
index 0000000..2fae5c4
--- /dev/null
+++ b/spec/acceptance/difference_spec.rb
@@ -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
diff --git a/spec/acceptance/dirname_spec.rb b/spec/acceptance/dirname_spec.rb
new file mode 100755
index 0000000..97913dd
--- /dev/null
+++ b/spec/acceptance/dirname_spec.rb
@@ -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
diff --git a/spec/acceptance/downcase_spec.rb b/spec/acceptance/downcase_spec.rb
new file mode 100755
index 0000000..bc4e706
--- /dev/null
+++ b/spec/acceptance/downcase_spec.rb
@@ -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
diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb
new file mode 100755
index 0000000..8b46aac
--- /dev/null
+++ b/spec/acceptance/empty_spec.rb
@@ -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
diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb
new file mode 100755
index 0000000..145bdc5
--- /dev/null
+++ b/spec/acceptance/ensure_packages_spec.rb
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ describe 'success' do
+ it 'ensure_packages a package' do
+ apply_manifest('package { "zsh": ensure => absent, }')
+ pp = <<-EOS
+ $a = "zsh"
+ ensure_packages($a)
+ EOS
+
+ apply_manifest(pp, :expect_changes => true) do |r|
+ expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/)
+ end
+ 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
diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb
new file mode 100755
index 0000000..c4d8887
--- /dev/null
+++ b/spec/acceptance/ensure_resource_spec.rb
@@ -0,0 +1,24 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ describe 'success' do
+ it 'ensure_resource a package' do
+ apply_manifest('package { "zsh": ensure => absent, }')
+ pp = <<-EOS
+ $a = "zsh"
+ ensure_resource('package', $a)
+ EOS
+
+ apply_manifest(pp, :expect_changes => true) do |r|
+ expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/)
+ end
+ 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
diff --git a/spec/acceptance/flatten_spec.rb b/spec/acceptance/flatten_spec.rb
new file mode 100755
index 0000000..c4d66e0
--- /dev/null
+++ b/spec/acceptance/flatten_spec.rb
@@ -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
diff --git a/spec/acceptance/floor_spec.rb b/spec/acceptance/floor_spec.rb
new file mode 100755
index 0000000..0dcdad9
--- /dev/null
+++ b/spec/acceptance/floor_spec.rb
@@ -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
diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb
new file mode 100755
index 0000000..b7f8bf8
--- /dev/null
+++ b/spec/acceptance/fqdn_rotate_spec.rb
@@ -0,0 +1,33 @@
+#! /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') == "true"
+ '/etc/puppetlabs/facter/facts.d'
+ 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
+ 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
diff --git a/spec/acceptance/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb
new file mode 100755
index 0000000..34d91fa
--- /dev/null
+++ b/spec/acceptance/get_module_path_spec.rb
@@ -0,0 +1,41 @@
+#! /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 stdlib' do
+ pp = <<-EOS
+ $a = $::is_pe ? {
+ 'true' => '/opt/puppet/share/puppet/modules/stdlib',
+ 'false' => '/etc/puppet/modules/stdlib',
+ }
+ $o = get_module_path('stdlib')
+ if $o == $a {
+ notify { 'output correct': }
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true) do |r|
+ expect(r.stdout).to match(/Notice: output correct/)
+ end
+ end
+ 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': }
+ }
+ EOS
+
+ apply_manifest(pp, :expect_failures => true)
+ end
+ end
+ describe 'failure' do
+ it 'handles improper argument counts'
+ it 'handles non-numbers'
+ end
+end
diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb
new file mode 100755
index 0000000..91fc9a0
--- /dev/null
+++ b/spec/acceptance/getparam_spec.rb
@@ -0,0 +1,25 @@
+#! /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 package' do
+ pp = <<-EOS
+ user { "rspec":
+ ensure => present,
+ managehome => true,
+ }
+ $o = getparam(User['rspec'], 'managehome')
+ notice(inline_template('getparam is <%= @o.inspect %>'))
+ EOS
+
+ apply_manifest(pp, :catch_failures => true) do |r|
+ expect(r.stdout).to match(/getparam is true/)
+ end
+ end
+ end
+ describe 'failure' do
+ it 'handles no arguments'
+ it 'handles non strings'
+ end
+end
diff --git a/spec/acceptance/getvar_spec.rb b/spec/acceptance/getvar_spec.rb
new file mode 100755
index 0000000..333c467
--- /dev/null
+++ b/spec/acceptance/getvar_spec.rb
@@ -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
diff --git a/spec/acceptance/grep_spec.rb b/spec/acceptance/grep_spec.rb
new file mode 100755
index 0000000..b39d48e
--- /dev/null
+++ b/spec/acceptance/grep_spec.rb
@@ -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
diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb
new file mode 100755
index 0000000..41ae19f
--- /dev/null
+++ b/spec/acceptance/has_interface_with_spec.rb
@@ -0,0 +1,44 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ describe 'success' do
+ it 'has_interface_with existing ipaddress' do
+ pp = <<-EOS
+ $a = '127.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 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
+ $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
diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb
new file mode 100755
index 0000000..7d5fd87
--- /dev/null
+++ b/spec/acceptance/has_ip_address_spec.rb
@@ -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')) 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
diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb
new file mode 100755
index 0000000..692eaf9
--- /dev/null
+++ b/spec/acceptance/has_ip_network_spec.rb
@@ -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')) 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
diff --git a/spec/acceptance/has_key_spec.rb b/spec/acceptance/has_key_spec.rb
new file mode 100755
index 0000000..c8557cb
--- /dev/null
+++ b/spec/acceptance/has_key_spec.rb
@@ -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
diff --git a/spec/acceptance/hash_spec.rb b/spec/acceptance/hash_spec.rb
new file mode 100755
index 0000000..ed53834
--- /dev/null
+++ b/spec/acceptance/hash_spec.rb
@@ -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
diff --git a/spec/acceptance/intersection_spec.rb b/spec/acceptance/intersection_spec.rb
new file mode 100755
index 0000000..66b8652
--- /dev/null
+++ b/spec/acceptance/intersection_spec.rb
@@ -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
diff --git a/spec/acceptance/is_array_spec.rb b/spec/acceptance/is_array_spec.rb
new file mode 100755
index 0000000..9c6bad7
--- /dev/null
+++ b/spec/acceptance/is_array_spec.rb
@@ -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
diff --git a/spec/acceptance/is_bool_spec.rb b/spec/acceptance/is_bool_spec.rb
new file mode 100755
index 0000000..60079f9
--- /dev/null
+++ b/spec/acceptance/is_bool_spec.rb
@@ -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
diff --git a/spec/acceptance/is_domain_name_spec.rb b/spec/acceptance/is_domain_name_spec.rb
new file mode 100755
index 0000000..e0f03fa
--- /dev/null
+++ b/spec/acceptance/is_domain_name_spec.rb
@@ -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
diff --git a/spec/acceptance/is_float_spec.rb b/spec/acceptance/is_float_spec.rb
new file mode 100755
index 0000000..338ba58
--- /dev/null
+++ b/spec/acceptance/is_float_spec.rb
@@ -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
diff --git a/spec/acceptance/is_function_available_spec.rb b/spec/acceptance/is_function_available_spec.rb
new file mode 100755
index 0000000..2b5dd6d
--- /dev/null
+++ b/spec/acceptance/is_function_available_spec.rb
@@ -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
diff --git a/spec/acceptance/is_hash_spec.rb b/spec/acceptance/is_hash_spec.rb
new file mode 100755
index 0000000..2ef310a
--- /dev/null
+++ b/spec/acceptance/is_hash_spec.rb
@@ -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
diff --git a/spec/acceptance/is_integer_spec.rb b/spec/acceptance/is_integer_spec.rb
new file mode 100755
index 0000000..bf6902b
--- /dev/null
+++ b/spec/acceptance/is_integer_spec.rb
@@ -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
diff --git a/spec/acceptance/is_ip_address_spec.rb b/spec/acceptance/is_ip_address_spec.rb
new file mode 100755
index 0000000..ed7a854
--- /dev/null
+++ b/spec/acceptance/is_ip_address_spec.rb
@@ -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
diff --git a/spec/acceptance/is_mac_address_spec.rb b/spec/acceptance/is_mac_address_spec.rb
new file mode 100755
index 0000000..a2c892f
--- /dev/null
+++ b/spec/acceptance/is_mac_address_spec.rb
@@ -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
diff --git a/spec/acceptance/is_numeric_spec.rb b/spec/acceptance/is_numeric_spec.rb
new file mode 100755
index 0000000..21c8988
--- /dev/null
+++ b/spec/acceptance/is_numeric_spec.rb
@@ -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
diff --git a/spec/acceptance/is_string_spec.rb b/spec/acceptance/is_string_spec.rb
new file mode 100755
index 0000000..94d8e96
--- /dev/null
+++ b/spec/acceptance/is_string_spec.rb
@@ -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
diff --git a/spec/acceptance/join_keys_to_values_spec.rb b/spec/acceptance/join_keys_to_values_spec.rb
new file mode 100755
index 0000000..70493fd
--- /dev/null
+++ b/spec/acceptance/join_keys_to_values_spec.rb
@@ -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
diff --git a/spec/acceptance/join_spec.rb b/spec/acceptance/join_spec.rb
new file mode 100755
index 0000000..5397ce2
--- /dev/null
+++ b/spec/acceptance/join_spec.rb
@@ -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
diff --git a/spec/acceptance/keys_spec.rb b/spec/acceptance/keys_spec.rb
new file mode 100755
index 0000000..176918e
--- /dev/null
+++ b/spec/acceptance/keys_spec.rb
@@ -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
diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb
new file mode 100644
index 0000000..944a727
--- /dev/null
+++ b/spec/acceptance/loadyaml_spec.rb
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+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" > /testyaml.yaml')
+ pp = <<-EOS
+ $o = loadyaml('/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
diff --git a/spec/acceptance/lstrip_spec.rb b/spec/acceptance/lstrip_spec.rb
new file mode 100755
index 0000000..3dc952f
--- /dev/null
+++ b/spec/acceptance/lstrip_spec.rb
@@ -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
diff --git a/spec/acceptance/max_spec.rb b/spec/acceptance/max_spec.rb
new file mode 100755
index 0000000..f04e3d2
--- /dev/null
+++ b/spec/acceptance/max_spec.rb
@@ -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
diff --git a/spec/acceptance/member_spec.rb b/spec/acceptance/member_spec.rb
new file mode 100755
index 0000000..b467dbb
--- /dev/null
+++ b/spec/acceptance/member_spec.rb
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ 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
+ it 'members arrays without members'
+ end
+ describe 'failure' do
+ it 'handles improper argument counts'
+ end
+end
diff --git a/spec/acceptance/merge_spec.rb b/spec/acceptance/merge_spec.rb
new file mode 100755
index 0000000..a60e784
--- /dev/null
+++ b/spec/acceptance/merge_spec.rb
@@ -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"/)
+ expect(r.stdout).to match(/merge\[two\] is "dos"/)
+ expect(r.stdout).to match(/merge\[three\] is {"five"=>"5"}/)
+ end
+ end
+ end
+end
diff --git a/spec/acceptance/min_spec.rb b/spec/acceptance/min_spec.rb
new file mode 100755
index 0000000..509092d
--- /dev/null
+++ b/spec/acceptance/min_spec.rb
@@ -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
diff --git a/spec/acceptance/nodesets/centos-6-vcloud.yml b/spec/acceptance/nodesets/centos-6-vcloud.yml
new file mode 100644
index 0000000..ca9c1d3
--- /dev/null
+++ b/spec/acceptance/nodesets/centos-6-vcloud.yml
@@ -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/
diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml
deleted file mode 100644
index 4e2cb80..0000000
--- a/spec/acceptance/nodesets/centos-65-x64.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-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
diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml
index 2719644..4e2cb80 120000..100644
--- a/spec/acceptance/nodesets/default.yml
+++ b/spec/acceptance/nodesets/default.yml
@@ -1 +1,10 @@
-centos-64-x64.yml \ No newline at end of file
+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
diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb
new file mode 100755
index 0000000..1d99ba0
--- /dev/null
+++ b/spec/acceptance/num2bool_spec.rb
@@ -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
diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb
new file mode 100755
index 0000000..5097810
--- /dev/null
+++ b/spec/acceptance/parsejson_spec.rb
@@ -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
diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb
new file mode 100755
index 0000000..4b4bf3d
--- /dev/null
+++ b/spec/acceptance/parseyaml_spec.rb
@@ -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/)
+ end
+ end
+
+ it 'raises error on incorrect number of arguments'
+ end
+end
diff --git a/spec/acceptance/pick_default_spec.rb b/spec/acceptance/pick_default_spec.rb
new file mode 100755
index 0000000..a663f54
--- /dev/null
+++ b/spec/acceptance/pick_default_spec.rb
@@ -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
diff --git a/spec/acceptance/pick_spec.rb b/spec/acceptance/pick_spec.rb
new file mode 100755
index 0000000..46cf63f
--- /dev/null
+++ b/spec/acceptance/pick_spec.rb
@@ -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
diff --git a/spec/acceptance/prefix_spec.rb b/spec/acceptance/prefix_spec.rb
new file mode 100755
index 0000000..de55530
--- /dev/null
+++ b/spec/acceptance/prefix_spec.rb
@@ -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
diff --git a/spec/acceptance/range_spec.rb b/spec/acceptance/range_spec.rb
new file mode 100755
index 0000000..a3ccd33
--- /dev/null
+++ b/spec/acceptance/range_spec.rb
@@ -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
diff --git a/spec/acceptance/reject_spec.rb b/spec/acceptance/reject_spec.rb
new file mode 100755
index 0000000..7f16a00
--- /dev/null
+++ b/spec/acceptance/reject_spec.rb
@@ -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
diff --git a/spec/acceptance/reverse_spec.rb b/spec/acceptance/reverse_spec.rb
new file mode 100755
index 0000000..c3f0156
--- /dev/null
+++ b/spec/acceptance/reverse_spec.rb
@@ -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
diff --git a/spec/acceptance/rstrip_spec.rb b/spec/acceptance/rstrip_spec.rb
new file mode 100755
index 0000000..b57a8b0
--- /dev/null
+++ b/spec/acceptance/rstrip_spec.rb
@@ -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
diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb
new file mode 100755
index 0000000..02d1201
--- /dev/null
+++ b/spec/acceptance/shuffle_spec.rb
@@ -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 = ["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 \["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
diff --git a/spec/acceptance/size_spec.rb b/spec/acceptance/size_spec.rb
new file mode 100755
index 0000000..a52b778
--- /dev/null
+++ b/spec/acceptance/size_spec.rb
@@ -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
diff --git a/spec/acceptance/sort_spec.rb b/spec/acceptance/sort_spec.rb
new file mode 100755
index 0000000..c85bfab
--- /dev/null
+++ b/spec/acceptance/sort_spec.rb
@@ -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
diff --git a/spec/acceptance/squeeze_spec.rb b/spec/acceptance/squeeze_spec.rb
new file mode 100755
index 0000000..400a458
--- /dev/null
+++ b/spec/acceptance/squeeze_spec.rb
@@ -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
diff --git a/spec/acceptance/str2bool_spec.rb b/spec/acceptance/str2bool_spec.rb
new file mode 100755
index 0000000..cf549da
--- /dev/null
+++ b/spec/acceptance/str2bool_spec.rb
@@ -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
diff --git a/spec/acceptance/str2saltedsha512_spec.rb b/spec/acceptance/str2saltedsha512_spec.rb
new file mode 100755
index 0000000..993e63b
--- /dev/null
+++ b/spec/acceptance/str2saltedsha512_spec.rb
@@ -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
diff --git a/spec/acceptance/strftime_spec.rb b/spec/acceptance/strftime_spec.rb
new file mode 100755
index 0000000..53b7f90
--- /dev/null
+++ b/spec/acceptance/strftime_spec.rb
@@ -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
diff --git a/spec/acceptance/strip_spec.rb b/spec/acceptance/strip_spec.rb
new file mode 100755
index 0000000..906fd7a
--- /dev/null
+++ b/spec/acceptance/strip_spec.rb
@@ -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
diff --git a/spec/acceptance/suffix_spec.rb b/spec/acceptance/suffix_spec.rb
new file mode 100755
index 0000000..630f866
--- /dev/null
+++ b/spec/acceptance/suffix_spec.rb
@@ -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
diff --git a/spec/acceptance/swapcase_spec.rb b/spec/acceptance/swapcase_spec.rb
new file mode 100755
index 0000000..b7894fb
--- /dev/null
+++ b/spec/acceptance/swapcase_spec.rb
@@ -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
diff --git a/spec/acceptance/time_spec.rb b/spec/acceptance/time_spec.rb
new file mode 100755
index 0000000..cdb2960
--- /dev/null
+++ b/spec/acceptance/time_spec.rb
@@ -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
diff --git a/spec/acceptance/to_bytes_spec.rb b/spec/acceptance/to_bytes_spec.rb
new file mode 100755
index 0000000..2b4c61f
--- /dev/null
+++ b/spec/acceptance/to_bytes_spec.rb
@@ -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
diff --git a/spec/acceptance/type_spec.rb b/spec/acceptance/type_spec.rb
new file mode 100755
index 0000000..0043aad
--- /dev/null
+++ b/spec/acceptance/type_spec.rb
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'type function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) 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
diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb
new file mode 100755
index 0000000..6db8d0c
--- /dev/null
+++ b/spec/acceptance/union_spec.rb
@@ -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
diff --git a/spec/acceptance/unique_spec.rb b/spec/acceptance/unique_spec.rb
new file mode 100755
index 0000000..bfadad1
--- /dev/null
+++ b/spec/acceptance/unique_spec.rb
@@ -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
diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb
index 449f35a..1c559f6 100644..100755
--- a/spec/acceptance/unsupported_spec.rb
+++ b/spec/acceptance/unsupported_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
diff --git a/spec/acceptance/upcase_spec.rb b/spec/acceptance/upcase_spec.rb
new file mode 100755
index 0000000..3d2906d
--- /dev/null
+++ b/spec/acceptance/upcase_spec.rb
@@ -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
diff --git a/spec/acceptance/uriescape_spec.rb b/spec/acceptance/uriescape_spec.rb
new file mode 100755
index 0000000..7e30205
--- /dev/null
+++ b/spec/acceptance/uriescape_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_absolute_path_spec.rb b/spec/acceptance/validate_absolute_path_spec.rb
new file mode 100755
index 0000000..7082e84
--- /dev/null
+++ b/spec/acceptance/validate_absolute_path_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_array_spec.rb b/spec/acceptance/validate_array_spec.rb
new file mode 100755
index 0000000..b53e98c
--- /dev/null
+++ b/spec/acceptance/validate_array_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb
new file mode 100755
index 0000000..aeec67a
--- /dev/null
+++ b/spec/acceptance/validate_augeas_spec.rb
@@ -0,0 +1,63 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) 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
diff --git a/spec/acceptance/validate_bool_spec.rb b/spec/acceptance/validate_bool_spec.rb
new file mode 100755
index 0000000..c837f08
--- /dev/null
+++ b/spec/acceptance/validate_bool_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb
new file mode 100755
index 0000000..385676d
--- /dev/null
+++ b/spec/acceptance/validate_cmd_spec.rb
@@ -0,0 +1,50 @@
+#! /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
+
+ expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/aoeu is dvorak/)
+ end
+ end
+ describe 'failure' do
+ it 'handles improper number of arguments'
+ it 'handles improper argument types'
+ end
+end
diff --git a/spec/acceptance/validate_hash_spec.rb b/spec/acceptance/validate_hash_spec.rb
new file mode 100755
index 0000000..52fb615
--- /dev/null
+++ b/spec/acceptance/validate_hash_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_ipv4_address_spec.rb b/spec/acceptance/validate_ipv4_address_spec.rb
new file mode 100755
index 0000000..64841c3
--- /dev/null
+++ b/spec/acceptance/validate_ipv4_address_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_ipv6_address_spec.rb b/spec/acceptance/validate_ipv6_address_spec.rb
new file mode 100755
index 0000000..6426d1a
--- /dev/null
+++ b/spec/acceptance/validate_ipv6_address_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_re_spec.rb b/spec/acceptance/validate_re_spec.rb
new file mode 100755
index 0000000..22f6d47
--- /dev/null
+++ b/spec/acceptance/validate_re_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_slength_spec.rb b/spec/acceptance/validate_slength_spec.rb
new file mode 100755
index 0000000..1ab2bb9
--- /dev/null
+++ b/spec/acceptance/validate_slength_spec.rb
@@ -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
diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb
new file mode 100755
index 0000000..8956f48
--- /dev/null
+++ b/spec/acceptance/validate_string_spec.rb
@@ -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
diff --git a/spec/acceptance/values_at_spec.rb b/spec/acceptance/values_at_spec.rb
new file mode 100755
index 0000000..da63cf3
--- /dev/null
+++ b/spec/acceptance/values_at_spec.rb
@@ -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
diff --git a/spec/acceptance/values_spec.rb b/spec/acceptance/values_spec.rb
new file mode 100755
index 0000000..7ef956e
--- /dev/null
+++ b/spec/acceptance/values_spec.rb
@@ -0,0 +1,31 @@
+#! /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
+
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "2", "3"\]/)
+ 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
diff --git a/spec/acceptance/zip_spec.rb b/spec/acceptance/zip_spec.rb
new file mode 100755
index 0000000..0e924e8
--- /dev/null
+++ b/spec/acceptance/zip_spec.rb
@@ -0,0 +1,74 @@
+#! /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
+
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\], \["3", "7"\], \["4", "8"\]\]/)
+ 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
+
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", true\], \["2", true\], \["three", false\], \["4", false\]\]/)
+ 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
+
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "5", "2", "6", "3", "7", "4", "8"\]/)
+ 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
+
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/)
+ 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
diff --git a/spec/classes/anchor_spec.rb b/spec/classes/anchor_spec.rb
index 2e1fcba..2d4455e 100644..100755
--- a/spec/classes/anchor_spec.rb
+++ b/spec/classes/anchor_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet_spec/compiler'
diff --git a/spec/unit/puppet/parser/functions/abs_spec.rb b/spec/functions/abs_spec.rb
index c0b4297..c0b4297 100755
--- a/spec/unit/puppet/parser/functions/abs_spec.rb
+++ b/spec/functions/abs_spec.rb
diff --git a/spec/unit/puppet/parser/functions/any2array_spec.rb b/spec/functions/any2array_spec.rb
index b266e84..b266e84 100644..100755
--- a/spec/unit/puppet/parser/functions/any2array_spec.rb
+++ b/spec/functions/any2array_spec.rb
diff --git a/spec/unit/puppet/parser/functions/base64_spec.rb b/spec/functions/base64_spec.rb
index 5faa5e6..5faa5e6 100755
--- a/spec/unit/puppet/parser/functions/base64_spec.rb
+++ b/spec/functions/base64_spec.rb
diff --git a/spec/unit/puppet/parser/functions/bool2num_spec.rb b/spec/functions/bool2num_spec.rb
index 518ac85..518ac85 100755
--- a/spec/unit/puppet/parser/functions/bool2num_spec.rb
+++ b/spec/functions/bool2num_spec.rb
diff --git a/spec/unit/puppet/parser/functions/capitalize_spec.rb b/spec/functions/capitalize_spec.rb
index 69c9758..69c9758 100755
--- a/spec/unit/puppet/parser/functions/capitalize_spec.rb
+++ b/spec/functions/capitalize_spec.rb
diff --git a/spec/unit/puppet/parser/functions/chomp_spec.rb b/spec/functions/chomp_spec.rb
index e425365..e425365 100755
--- a/spec/unit/puppet/parser/functions/chomp_spec.rb
+++ b/spec/functions/chomp_spec.rb
diff --git a/spec/unit/puppet/parser/functions/chop_spec.rb b/spec/functions/chop_spec.rb
index 9e466de..9e466de 100755
--- a/spec/unit/puppet/parser/functions/chop_spec.rb
+++ b/spec/functions/chop_spec.rb
diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb
new file mode 100755
index 0000000..6e67620
--- /dev/null
+++ b/spec/functions/concat_spec.rb
@@ -0,0 +1,30 @@
+#! /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
+ lambda { scope.function_concat([]) }.should(raise_error(Puppet::ParseError))
+ end
+
+ it "should raise a ParseError if the first parameter is not an array" do
+ lambda { scope.function_concat([1, []])}.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
+
+ it "should be able to concat a primitive to an array" do
+ result = scope.function_concat([['1','2','3'],'4'])
+ result.should(eq(['1','2','3','4']))
+ end
+
+ it "should not accidentally flatten nested arrays" do
+ result = scope.function_concat([['1','2','3'],[['4','5'],'6']])
+ result.should(eq(['1','2','3',['4','5'],'6']))
+ end
+
+end
diff --git a/spec/unit/puppet/parser/functions/count_spec.rb b/spec/functions/count_spec.rb
index 2453815..2453815 100644..100755
--- a/spec/unit/puppet/parser/functions/count_spec.rb
+++ b/spec/functions/count_spec.rb
diff --git a/spec/unit/puppet/parser/functions/deep_merge_spec.rb b/spec/functions/deep_merge_spec.rb
index f134701..f134701 100644..100755
--- a/spec/unit/puppet/parser/functions/deep_merge_spec.rb
+++ b/spec/functions/deep_merge_spec.rb
diff --git a/spec/functions/defined_with_params_spec.rb b/spec/functions/defined_with_params_spec.rb
index 28dbab3..28dbab3 100644..100755
--- a/spec/functions/defined_with_params_spec.rb
+++ b/spec/functions/defined_with_params_spec.rb
diff --git a/spec/unit/puppet/parser/functions/delete_at_spec.rb b/spec/functions/delete_at_spec.rb
index 593cf45..593cf45 100755
--- a/spec/unit/puppet/parser/functions/delete_at_spec.rb
+++ b/spec/functions/delete_at_spec.rb
diff --git a/spec/unit/puppet/parser/functions/delete_spec.rb b/spec/functions/delete_spec.rb
index 1508a63..1508a63 100755
--- a/spec/unit/puppet/parser/functions/delete_spec.rb
+++ b/spec/functions/delete_spec.rb
diff --git a/spec/unit/puppet/parser/functions/delete_undef_values_spec.rb b/spec/functions/delete_undef_values_spec.rb
index b341d88..b341d88 100644..100755
--- a/spec/unit/puppet/parser/functions/delete_undef_values_spec.rb
+++ b/spec/functions/delete_undef_values_spec.rb
diff --git a/spec/unit/puppet/parser/functions/delete_values_spec.rb b/spec/functions/delete_values_spec.rb
index 8d7f231..8d7f231 100644..100755
--- a/spec/unit/puppet/parser/functions/delete_values_spec.rb
+++ b/spec/functions/delete_values_spec.rb
diff --git a/spec/unit/puppet/parser/functions/difference_spec.rb b/spec/functions/difference_spec.rb
index 9feff09..9feff09 100644..100755
--- a/spec/unit/puppet/parser/functions/difference_spec.rb
+++ b/spec/functions/difference_spec.rb
diff --git a/spec/unit/puppet/parser/functions/dirname_spec.rb b/spec/functions/dirname_spec.rb
index fb3b4fe..fb3b4fe 100755
--- a/spec/unit/puppet/parser/functions/dirname_spec.rb
+++ b/spec/functions/dirname_spec.rb
diff --git a/spec/unit/puppet/parser/functions/downcase_spec.rb b/spec/functions/downcase_spec.rb
index acef1f0..acef1f0 100755
--- a/spec/unit/puppet/parser/functions/downcase_spec.rb
+++ b/spec/functions/downcase_spec.rb
diff --git a/spec/unit/puppet/parser/functions/empty_spec.rb b/spec/functions/empty_spec.rb
index 7745875..7745875 100755
--- a/spec/unit/puppet/parser/functions/empty_spec.rb
+++ b/spec/functions/empty_spec.rb
diff --git a/spec/functions/ensure_packages_spec.rb b/spec/functions/ensure_packages_spec.rb
index bf62eff..436be10 100644..100755
--- a/spec/functions/ensure_packages_spec.rb
+++ b/spec/functions/ensure_packages_spec.rb
@@ -32,7 +32,7 @@ describe 'ensure_packages' do
it 'fails with no arguments' do
expect {
scope.function_ensure_packages([])
- }.to raise_error(Puppet::ParseError, /0 for 1/)
+ }.to raise_error(Puppet::ParseError, /0 for 1 or 2/)
end
it 'accepts an array of values' do
@@ -67,4 +67,15 @@ describe 'ensure_packages' do
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
diff --git a/spec/functions/ensure_resource_spec.rb b/spec/functions/ensure_resource_spec.rb
index 459d917..33bcac0 100644..100755
--- a/spec/functions/ensure_resource_spec.rb
+++ b/spec/functions/ensure_resource_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'rspec-puppet'
require 'puppet_spec/compiler'
diff --git a/spec/unit/puppet/parser/functions/flatten_spec.rb b/spec/functions/flatten_spec.rb
index dba7a6b..dba7a6b 100755
--- a/spec/unit/puppet/parser/functions/flatten_spec.rb
+++ b/spec/functions/flatten_spec.rb
diff --git a/spec/unit/puppet/parser/functions/floor_spec.rb b/spec/functions/floor_spec.rb
index dbc8c77..dbc8c77 100644..100755
--- a/spec/unit/puppet/parser/functions/floor_spec.rb
+++ b/spec/functions/floor_spec.rb
diff --git a/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb b/spec/functions/fqdn_rotate_spec.rb
index 2577723..2577723 100644..100755
--- a/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb
+++ b/spec/functions/fqdn_rotate_spec.rb
diff --git a/spec/unit/puppet/parser/functions/get_module_path_spec.rb b/spec/functions/get_module_path_spec.rb
index 486bef6..486bef6 100644..100755
--- a/spec/unit/puppet/parser/functions/get_module_path_spec.rb
+++ b/spec/functions/get_module_path_spec.rb
diff --git a/spec/functions/getparam_spec.rb b/spec/functions/getparam_spec.rb
index 7f5ad1a..bf024af 100644..100755
--- a/spec/functions/getparam_spec.rb
+++ b/spec/functions/getparam_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'rspec-puppet'
require 'puppet_spec/compiler'
diff --git a/spec/unit/puppet/parser/functions/getvar_spec.rb b/spec/functions/getvar_spec.rb
index 5ff834e..5ff834e 100644..100755
--- a/spec/unit/puppet/parser/functions/getvar_spec.rb
+++ b/spec/functions/getvar_spec.rb
diff --git a/spec/unit/puppet/parser/functions/grep_spec.rb b/spec/functions/grep_spec.rb
index a93b842..a93b842 100755
--- a/spec/unit/puppet/parser/functions/grep_spec.rb
+++ b/spec/functions/grep_spec.rb
diff --git a/spec/unit/puppet/parser/functions/has_interface_with_spec.rb b/spec/functions/has_interface_with_spec.rb
index c5264e4..c5264e4 100755
--- a/spec/unit/puppet/parser/functions/has_interface_with_spec.rb
+++ b/spec/functions/has_interface_with_spec.rb
diff --git a/spec/unit/puppet/parser/functions/has_ip_address_spec.rb b/spec/functions/has_ip_address_spec.rb
index 5a68460..5a68460 100755
--- a/spec/unit/puppet/parser/functions/has_ip_address_spec.rb
+++ b/spec/functions/has_ip_address_spec.rb
diff --git a/spec/unit/puppet/parser/functions/has_ip_network_spec.rb b/spec/functions/has_ip_network_spec.rb
index c3a289e..c3a289e 100755
--- a/spec/unit/puppet/parser/functions/has_ip_network_spec.rb
+++ b/spec/functions/has_ip_network_spec.rb
diff --git a/spec/unit/puppet/parser/functions/has_key_spec.rb b/spec/functions/has_key_spec.rb
index 490daea..490daea 100644..100755
--- a/spec/unit/puppet/parser/functions/has_key_spec.rb
+++ b/spec/functions/has_key_spec.rb
diff --git a/spec/unit/puppet/parser/functions/hash_spec.rb b/spec/functions/hash_spec.rb
index 7c91be9..7c91be9 100644..100755
--- a/spec/unit/puppet/parser/functions/hash_spec.rb
+++ b/spec/functions/hash_spec.rb
diff --git a/spec/unit/puppet/parser/functions/intersection_spec.rb b/spec/functions/intersection_spec.rb
index fd44f7f..fd44f7f 100644..100755
--- a/spec/unit/puppet/parser/functions/intersection_spec.rb
+++ b/spec/functions/intersection_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_array_spec.rb b/spec/functions/is_array_spec.rb
index e7f4bcd..e7f4bcd 100644..100755
--- a/spec/unit/puppet/parser/functions/is_array_spec.rb
+++ b/spec/functions/is_array_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_bool_spec.rb b/spec/functions/is_bool_spec.rb
index c94e83a..c94e83a 100644..100755
--- a/spec/unit/puppet/parser/functions/is_bool_spec.rb
+++ b/spec/functions/is_bool_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_domain_name_spec.rb b/spec/functions/is_domain_name_spec.rb
index f2ea76d..f2ea76d 100644..100755
--- a/spec/unit/puppet/parser/functions/is_domain_name_spec.rb
+++ b/spec/functions/is_domain_name_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_float_spec.rb b/spec/functions/is_float_spec.rb
index b7d73b0..b7d73b0 100644..100755
--- a/spec/unit/puppet/parser/functions/is_float_spec.rb
+++ b/spec/functions/is_float_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_function_available.rb b/spec/functions/is_function_available.rb
index d5669a7..d5669a7 100644..100755
--- a/spec/unit/puppet/parser/functions/is_function_available.rb
+++ b/spec/functions/is_function_available.rb
diff --git a/spec/unit/puppet/parser/functions/is_hash_spec.rb b/spec/functions/is_hash_spec.rb
index bbebf39..bbebf39 100644..100755
--- a/spec/unit/puppet/parser/functions/is_hash_spec.rb
+++ b/spec/functions/is_hash_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_integer_spec.rb b/spec/functions/is_integer_spec.rb
index 24141cc..24141cc 100644..100755
--- a/spec/unit/puppet/parser/functions/is_integer_spec.rb
+++ b/spec/functions/is_integer_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_ip_address_spec.rb b/spec/functions/is_ip_address_spec.rb
index c0debb3..c0debb3 100644..100755
--- a/spec/unit/puppet/parser/functions/is_ip_address_spec.rb
+++ b/spec/functions/is_ip_address_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_mac_address_spec.rb b/spec/functions/is_mac_address_spec.rb
index ca9c590..ca9c590 100644..100755
--- a/spec/unit/puppet/parser/functions/is_mac_address_spec.rb
+++ b/spec/functions/is_mac_address_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_numeric_spec.rb b/spec/functions/is_numeric_spec.rb
index 1df1497..1df1497 100644..100755
--- a/spec/unit/puppet/parser/functions/is_numeric_spec.rb
+++ b/spec/functions/is_numeric_spec.rb
diff --git a/spec/unit/puppet/parser/functions/is_string_spec.rb b/spec/functions/is_string_spec.rb
index 3756bea..3756bea 100644..100755
--- a/spec/unit/puppet/parser/functions/is_string_spec.rb
+++ b/spec/functions/is_string_spec.rb
diff --git a/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb b/spec/functions/join_keys_to_values_spec.rb
index a52fb71..a52fb71 100644..100755
--- a/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb
+++ b/spec/functions/join_keys_to_values_spec.rb
diff --git a/spec/unit/puppet/parser/functions/join_spec.rb b/spec/functions/join_spec.rb
index aafa1a7..aafa1a7 100644..100755
--- a/spec/unit/puppet/parser/functions/join_spec.rb
+++ b/spec/functions/join_spec.rb
diff --git a/spec/unit/puppet/parser/functions/keys_spec.rb b/spec/functions/keys_spec.rb
index fdd7a70..fdd7a70 100644..100755
--- a/spec/unit/puppet/parser/functions/keys_spec.rb
+++ b/spec/functions/keys_spec.rb
diff --git a/spec/unit/puppet/parser/functions/loadyaml_spec.rb b/spec/functions/loadyaml_spec.rb
index fe16318..fe16318 100644..100755
--- a/spec/unit/puppet/parser/functions/loadyaml_spec.rb
+++ b/spec/functions/loadyaml_spec.rb
diff --git a/spec/unit/puppet/parser/functions/lstrip_spec.rb b/spec/functions/lstrip_spec.rb
index b280ae7..b280ae7 100644..100755
--- a/spec/unit/puppet/parser/functions/lstrip_spec.rb
+++ b/spec/functions/lstrip_spec.rb
diff --git a/spec/unit/puppet/parser/functions/max_spec.rb b/spec/functions/max_spec.rb
index ff6f2b3..ff6f2b3 100755
--- a/spec/unit/puppet/parser/functions/max_spec.rb
+++ b/spec/functions/max_spec.rb
diff --git a/spec/unit/puppet/parser/functions/member_spec.rb b/spec/functions/member_spec.rb
index 6e9a023..6e9a023 100644..100755
--- a/spec/unit/puppet/parser/functions/member_spec.rb
+++ b/spec/functions/member_spec.rb
diff --git a/spec/unit/puppet/parser/functions/merge_spec.rb b/spec/functions/merge_spec.rb
index 15a5d94..15a5d94 100644..100755
--- a/spec/unit/puppet/parser/functions/merge_spec.rb
+++ b/spec/functions/merge_spec.rb
diff --git a/spec/unit/puppet/parser/functions/min_spec.rb b/spec/functions/min_spec.rb
index 71d593e..71d593e 100755
--- a/spec/unit/puppet/parser/functions/min_spec.rb
+++ b/spec/functions/min_spec.rb
diff --git a/spec/unit/puppet/parser/functions/num2bool_spec.rb b/spec/functions/num2bool_spec.rb
index b56196d..b56196d 100644..100755
--- a/spec/unit/puppet/parser/functions/num2bool_spec.rb
+++ b/spec/functions/num2bool_spec.rb
diff --git a/spec/unit/puppet/parser/functions/parsejson_spec.rb b/spec/functions/parsejson_spec.rb
index f179ac1..f179ac1 100644..100755
--- a/spec/unit/puppet/parser/functions/parsejson_spec.rb
+++ b/spec/functions/parsejson_spec.rb
diff --git a/spec/unit/puppet/parser/functions/parseyaml_spec.rb b/spec/functions/parseyaml_spec.rb
index 0c7aea8..0c7aea8 100644..100755
--- a/spec/unit/puppet/parser/functions/parseyaml_spec.rb
+++ b/spec/functions/parseyaml_spec.rb
diff --git a/spec/unit/puppet/parser/functions/pick_default_spec.rb b/spec/functions/pick_default_spec.rb
index c9235b5..c9235b5 100644..100755
--- a/spec/unit/puppet/parser/functions/pick_default_spec.rb
+++ b/spec/functions/pick_default_spec.rb
diff --git a/spec/unit/puppet/parser/functions/pick_spec.rb b/spec/functions/pick_spec.rb
index f53fa80..f53fa80 100755
--- a/spec/unit/puppet/parser/functions/pick_spec.rb
+++ b/spec/functions/pick_spec.rb
diff --git a/spec/unit/puppet/parser/functions/prefix_spec.rb b/spec/functions/prefix_spec.rb
index 6e8ddc5..6e8ddc5 100644..100755
--- a/spec/unit/puppet/parser/functions/prefix_spec.rb
+++ b/spec/functions/prefix_spec.rb
diff --git a/spec/unit/puppet/parser/functions/range_spec.rb b/spec/functions/range_spec.rb
index 0e1ad37..0e1ad37 100644..100755
--- a/spec/unit/puppet/parser/functions/range_spec.rb
+++ b/spec/functions/range_spec.rb
diff --git a/spec/unit/puppet/parser/functions/reject_spec.rb b/spec/functions/reject_spec.rb
index f2cb741..f2cb741 100755
--- a/spec/unit/puppet/parser/functions/reject_spec.rb
+++ b/spec/functions/reject_spec.rb
diff --git a/spec/unit/puppet/parser/functions/reverse_spec.rb b/spec/functions/reverse_spec.rb
index 1b59206..1b59206 100644..100755
--- a/spec/unit/puppet/parser/functions/reverse_spec.rb
+++ b/spec/functions/reverse_spec.rb
diff --git a/spec/unit/puppet/parser/functions/rstrip_spec.rb b/spec/functions/rstrip_spec.rb
index d90de1d..d90de1d 100644..100755
--- a/spec/unit/puppet/parser/functions/rstrip_spec.rb
+++ b/spec/functions/rstrip_spec.rb
diff --git a/spec/unit/puppet/parser/functions/shuffle_spec.rb b/spec/functions/shuffle_spec.rb
index 93346d5..93346d5 100644..100755
--- a/spec/unit/puppet/parser/functions/shuffle_spec.rb
+++ b/spec/functions/shuffle_spec.rb
diff --git a/spec/unit/puppet/parser/functions/size_spec.rb b/spec/functions/size_spec.rb
index b1c435a..b1c435a 100644..100755
--- a/spec/unit/puppet/parser/functions/size_spec.rb
+++ b/spec/functions/size_spec.rb
diff --git a/spec/unit/puppet/parser/functions/sort_spec.rb b/spec/functions/sort_spec.rb
index 3187a5a..3187a5a 100644..100755
--- a/spec/unit/puppet/parser/functions/sort_spec.rb
+++ b/spec/functions/sort_spec.rb
diff --git a/spec/unit/puppet/parser/functions/squeeze_spec.rb b/spec/functions/squeeze_spec.rb
index 60e5a30..60e5a30 100644..100755
--- a/spec/unit/puppet/parser/functions/squeeze_spec.rb
+++ b/spec/functions/squeeze_spec.rb
diff --git a/spec/unit/puppet/parser/functions/str2bool_spec.rb b/spec/functions/str2bool_spec.rb
index 73c09c7..73c09c7 100644..100755
--- a/spec/unit/puppet/parser/functions/str2bool_spec.rb
+++ b/spec/functions/str2bool_spec.rb
diff --git a/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb b/spec/functions/str2saltedsha512_spec.rb
index df8fb8e..df8fb8e 100644..100755
--- a/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb
+++ b/spec/functions/str2saltedsha512_spec.rb
diff --git a/spec/unit/puppet/parser/functions/strftime_spec.rb b/spec/functions/strftime_spec.rb
index df42b6f..df42b6f 100644..100755
--- a/spec/unit/puppet/parser/functions/strftime_spec.rb
+++ b/spec/functions/strftime_spec.rb
diff --git a/spec/unit/puppet/parser/functions/strip_spec.rb b/spec/functions/strip_spec.rb
index fccdd26..fccdd26 100644..100755
--- a/spec/unit/puppet/parser/functions/strip_spec.rb
+++ b/spec/functions/strip_spec.rb
diff --git a/spec/unit/puppet/parser/functions/suffix_spec.rb b/spec/functions/suffix_spec.rb
index 89ba3b8..89ba3b8 100644..100755
--- a/spec/unit/puppet/parser/functions/suffix_spec.rb
+++ b/spec/functions/suffix_spec.rb
diff --git a/spec/unit/puppet/parser/functions/swapcase_spec.rb b/spec/functions/swapcase_spec.rb
index 808b415..808b415 100644..100755
--- a/spec/unit/puppet/parser/functions/swapcase_spec.rb
+++ b/spec/functions/swapcase_spec.rb
diff --git a/spec/unit/puppet/parser/functions/time_spec.rb b/spec/functions/time_spec.rb
index e9fb76e..e9fb76e 100644..100755
--- a/spec/unit/puppet/parser/functions/time_spec.rb
+++ b/spec/functions/time_spec.rb
diff --git a/spec/unit/puppet/parser/functions/to_bytes_spec.rb b/spec/functions/to_bytes_spec.rb
index d1ea4c8..d1ea4c8 100755
--- a/spec/unit/puppet/parser/functions/to_bytes_spec.rb
+++ b/spec/functions/to_bytes_spec.rb
diff --git a/spec/unit/puppet/parser/functions/type_spec.rb b/spec/functions/type_spec.rb
index 8fec88f..8fec88f 100644..100755
--- a/spec/unit/puppet/parser/functions/type_spec.rb
+++ b/spec/functions/type_spec.rb
diff --git a/spec/unit/puppet/parser/functions/union_spec.rb b/spec/functions/union_spec.rb
index 0d282ca..0d282ca 100644..100755
--- a/spec/unit/puppet/parser/functions/union_spec.rb
+++ b/spec/functions/union_spec.rb
diff --git a/spec/unit/puppet/parser/functions/unique_spec.rb b/spec/functions/unique_spec.rb
index 5d48d49..5d48d49 100644..100755
--- a/spec/unit/puppet/parser/functions/unique_spec.rb
+++ b/spec/functions/unique_spec.rb
diff --git a/spec/unit/puppet/parser/functions/upcase_spec.rb b/spec/functions/upcase_spec.rb
index 5db5513..5db5513 100644..100755
--- a/spec/unit/puppet/parser/functions/upcase_spec.rb
+++ b/spec/functions/upcase_spec.rb
diff --git a/spec/unit/puppet/parser/functions/uriescape_spec.rb b/spec/functions/uriescape_spec.rb
index 7211c88..7211c88 100644..100755
--- a/spec/unit/puppet/parser/functions/uriescape_spec.rb
+++ b/spec/functions/uriescape_spec.rb
diff --git a/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb b/spec/functions/validate_absolute_path_spec.rb
index 1c9cce2..342ae84 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb
+++ b/spec/functions/validate_absolute_path_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
describe Puppet::Parser::Functions.function(:validate_absolute_path) do
diff --git a/spec/unit/puppet/parser/functions/validate_array_spec.rb b/spec/functions/validate_array_spec.rb
index 4b31cfd..4b31cfd 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_array_spec.rb
+++ b/spec/functions/validate_array_spec.rb
diff --git a/spec/unit/puppet/parser/functions/validate_augeas_spec.rb b/spec/functions/validate_augeas_spec.rb
index ab5c140..c695ba2 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_augeas_spec.rb
+++ b/spec/functions/validate_augeas_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
describe Puppet::Parser::Functions.function(:validate_augeas), :if => Puppet.features.augeas? do
diff --git a/spec/unit/puppet/parser/functions/validate_bool_spec.rb b/spec/functions/validate_bool_spec.rb
index 261fb23..a352d3b 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_bool_spec.rb
+++ b/spec/functions/validate_bool_spec.rb
@@ -1,4 +1,4 @@
-#! /usr/bin/env/ruby -S rspec
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
diff --git a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb b/spec/functions/validate_cmd_spec.rb
index a86cb01..a6e68df 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb
+++ b/spec/functions/validate_cmd_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
TESTEXE = File.exists?('/usr/bin/test') ? '/usr/bin/test' : '/bin/test'
diff --git a/spec/unit/puppet/parser/functions/validate_hash_spec.rb b/spec/functions/validate_hash_spec.rb
index a0c35c2..a0c35c2 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_hash_spec.rb
+++ b/spec/functions/validate_hash_spec.rb
diff --git a/spec/unit/puppet/parser/functions/validate_ipv4_address_spec.rb b/spec/functions/validate_ipv4_address_spec.rb
index 85536d3..45401a4 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_ipv4_address_spec.rb
+++ b/spec/functions/validate_ipv4_address_spec.rb
@@ -1,4 +1,4 @@
-#! /usr/bin/env/ruby -S rspec
+#! /usr/bin/env ruby -S rspec
require "spec_helper"
diff --git a/spec/unit/puppet/parser/functions/validate_ipv6_address_spec.rb b/spec/functions/validate_ipv6_address_spec.rb
index 1fe5304..a839d90 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_ipv6_address_spec.rb
+++ b/spec/functions/validate_ipv6_address_spec.rb
@@ -1,4 +1,4 @@
-#! /usr/bin/env/ruby -S rspec
+#! /usr/bin/env ruby -S rspec
require "spec_helper"
diff --git a/spec/unit/puppet/parser/functions/validate_re_spec.rb b/spec/functions/validate_re_spec.rb
index d189efb..d29988b 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_re_spec.rb
+++ b/spec/functions/validate_re_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
describe Puppet::Parser::Functions.function(:validate_re) do
diff --git a/spec/unit/puppet/parser/functions/validate_slength_spec.rb b/spec/functions/validate_slength_spec.rb
index 851835f..851835f 100755
--- a/spec/unit/puppet/parser/functions/validate_slength_spec.rb
+++ b/spec/functions/validate_slength_spec.rb
diff --git a/spec/unit/puppet/parser/functions/validate_string_spec.rb b/spec/functions/validate_string_spec.rb
index 3b4fb3e..3b4fb3e 100644..100755
--- a/spec/unit/puppet/parser/functions/validate_string_spec.rb
+++ b/spec/functions/validate_string_spec.rb
diff --git a/spec/unit/puppet/parser/functions/values_at_spec.rb b/spec/functions/values_at_spec.rb
index 08e95a5..08e95a5 100644..100755
--- a/spec/unit/puppet/parser/functions/values_at_spec.rb
+++ b/spec/functions/values_at_spec.rb
diff --git a/spec/unit/puppet/parser/functions/values_spec.rb b/spec/functions/values_spec.rb
index 14ae417..14ae417 100644..100755
--- a/spec/unit/puppet/parser/functions/values_spec.rb
+++ b/spec/functions/values_spec.rb
diff --git a/spec/unit/puppet/parser/functions/zip_spec.rb b/spec/functions/zip_spec.rb
index f45ab17..f45ab17 100644..100755
--- a/spec/unit/puppet/parser/functions/zip_spec.rb
+++ b/spec/functions/zip_spec.rb
diff --git a/spec/lib/puppet_spec/compiler.rb b/spec/lib/puppet_spec/compiler.rb
index 22e923d..2f0ae4d 100644..100755
--- a/spec/lib/puppet_spec/compiler.rb
+++ b/spec/lib/puppet_spec/compiler.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
module PuppetSpec::Compiler
def compile_to_catalog(string, node = Puppet::Node.new('foonode'))
Puppet[:code] = string
diff --git a/spec/lib/puppet_spec/database.rb b/spec/lib/puppet_spec/database.rb
index 069ca15..f5c2341 100644..100755
--- a/spec/lib/puppet_spec/database.rb
+++ b/spec/lib/puppet_spec/database.rb
@@ -1,3 +1,4 @@
+#! /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.
diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb
index 65b04aa..71b38ff 100755
--- a/spec/lib/puppet_spec/files.rb
+++ b/spec/lib/puppet_spec/files.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'fileutils'
require 'tempfile'
require 'tmpdir'
diff --git a/spec/lib/puppet_spec/fixtures.rb b/spec/lib/puppet_spec/fixtures.rb
index 7f6bc2a..81e9775 100755
--- a/spec/lib/puppet_spec/fixtures.rb
+++ b/spec/lib/puppet_spec/fixtures.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
module PuppetSpec::Fixtures
def fixtures(*rest)
File.join(PuppetSpec::FIXTURE_DIR, *rest)
diff --git a/spec/lib/puppet_spec/matchers.rb b/spec/lib/puppet_spec/matchers.rb
index 448bd18..093d77c 100644..100755
--- a/spec/lib/puppet_spec/matchers.rb
+++ b/spec/lib/puppet_spec/matchers.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'stringio'
########################################################################
diff --git a/spec/lib/puppet_spec/modules.rb b/spec/lib/puppet_spec/modules.rb
index 6835e44..910c6d9 100644..100755
--- a/spec/lib/puppet_spec/modules.rb
+++ b/spec/lib/puppet_spec/modules.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
module PuppetSpec::Modules
class << self
def create(name, dir, options = {})
diff --git a/spec/lib/puppet_spec/pops.rb b/spec/lib/puppet_spec/pops.rb
index 442c85b..e056a52 100644..100755
--- a/spec/lib/puppet_spec/pops.rb
+++ b/spec/lib/puppet_spec/pops.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
module PuppetSpec::Pops
extend RSpec::Matchers::DSL
diff --git a/spec/lib/puppet_spec/scope.rb b/spec/lib/puppet_spec/scope.rb
index c14ab47..3847ede 100644..100755
--- a/spec/lib/puppet_spec/scope.rb
+++ b/spec/lib/puppet_spec/scope.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
module PuppetSpec::Scope
# Initialize a new scope suitable for testing.
diff --git a/spec/lib/puppet_spec/settings.rb b/spec/lib/puppet_spec/settings.rb
index f3dbc42..8ddcb97 100644..100755
--- a/spec/lib/puppet_spec/settings.rb
+++ b/spec/lib/puppet_spec/settings.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
module PuppetSpec::Settings
# It would probably be preferable to refactor defaults.rb such that the real definitions of
diff --git a/spec/lib/puppet_spec/verbose.rb b/spec/lib/puppet_spec/verbose.rb
index d9834f2..b2683df 100755
--- a/spec/lib/puppet_spec/verbose.rb
+++ b/spec/lib/puppet_spec/verbose.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
# Support code for running stuff with warnings disabled.
module Kernel
def with_verbose_disabled
diff --git a/spec/monkey_patches/alias_should_to_must.rb b/spec/monkey_patches/alias_should_to_must.rb
index 1a11117..505e240 100755
--- a/spec/monkey_patches/alias_should_to_must.rb
+++ b/spec/monkey_patches/alias_should_to_must.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'rspec'
class Object
diff --git a/spec/monkey_patches/publicize_methods.rb b/spec/monkey_patches/publicize_methods.rb
index f3a1abf..3ae59f9 100755
--- a/spec/monkey_patches/publicize_methods.rb
+++ b/spec/monkey_patches/publicize_methods.rb
@@ -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)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cf1981b..78925fd 100644..100755
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
dir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift File.join(dir, 'lib')
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 4cefa75..8e56daa 100644..100755
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,17 +1,19 @@
+#! /usr/bin/env ruby -S rspec
require 'beaker-rspec'
UNSUPPORTED_PLATFORMS = []
-unless ENV['RS_PROVISION'] == 'no'
+unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
+ if hosts.first.is_pe?
+ install_pe
+ on hosts, 'mkdir -p /etc/puppetlabs/facter/facts.d'
+ else
+ install_puppet
+ on hosts, 'mkdir -p /etc/facter/facts.d'
+ on hosts, '/bin/touch /etc/puppet/hiera.yaml'
+ end
hosts.each do |host|
- # Install Puppet
- if host.is_pe?
- install_pe
- else
- install_package host, 'rubygems'
- on host, 'gem install puppet --no-ri --no-rdoc'
- on host, "mkdir -p #{host['distmoduledir']}"
- end
+ on host, "mkdir -p #{host['distmoduledir']}"
end
end
@@ -24,10 +26,6 @@ RSpec.configure do |c|
# Configure all nodes in nodeset
c.before :suite do
- # Install module and dependencies
puppet_module_install(:source => proj_root, :module_name => 'stdlib')
- hosts.each do |host|
- shell('/bin/touch /etc/puppet/hiera.yaml')
- end
end
end
diff --git a/spec/unit/facter/facter_dot_d_spec.rb b/spec/unit/facter/facter_dot_d_spec.rb
new file mode 100755
index 0000000..2fb72b2
--- /dev/null
+++ b/spec/unit/facter/facter_dot_d_spec.rb
@@ -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
+ Facter.fact(:fake_fact).value.should == '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
+ Facter.fact(:foo).value.should == '1+1=2'
+ end
+ end
+end
diff --git a/spec/unit/facter/pe_required_facts_spec.rb b/spec/unit/facter/pe_required_facts_spec.rb
deleted file mode 100644
index 85ff6ab..0000000
--- a/spec/unit/facter/pe_required_facts_spec.rb
+++ /dev/null
@@ -1,70 +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")
- Facter::Util::Root.stubs(:root?).returns(true)
- # 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
diff --git a/spec/unit/facter/pe_version_spec.rb b/spec/unit/facter/pe_version_spec.rb
index 931c6d4..931c6d4 100644..100755
--- a/spec/unit/facter/pe_version_spec.rb
+++ b/spec/unit/facter/pe_version_spec.rb
diff --git a/spec/unit/facter/root_home_spec.rb b/spec/unit/facter/root_home_spec.rb
index 532fae1..73eb3ea 100644..100755
--- a/spec/unit/facter/root_home_spec.rb
+++ b/spec/unit/facter/root_home_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'facter/root_home'
diff --git a/spec/unit/facter/util/puppet_settings_spec.rb b/spec/unit/facter/util/puppet_settings_spec.rb
index c3ce6ea..e77779b 100644..100755
--- a/spec/unit/facter/util/puppet_settings_spec.rb
+++ b/spec/unit/facter/util/puppet_settings_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'facter/util/puppet_settings'
diff --git a/spec/unit/puppet/parser/functions/concat_spec.rb b/spec/unit/puppet/parser/functions/concat_spec.rb
deleted file mode 100644
index 123188b..0000000
--- a/spec/unit/puppet/parser/functions/concat_spec.rb
+++ /dev/null
@@ -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
diff --git a/spec/unit/puppet/provider/file_line/ruby_spec.rb b/spec/unit/puppet/provider/file_line/ruby_spec.rb
index c356bd2..a016b68 100644..100755
--- a/spec/unit/puppet/provider/file_line/ruby_spec.rb
+++ b/spec/unit/puppet/provider/file_line/ruby_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'tempfile'
provider_class = Puppet::Type.type(:file_line).provider(:ruby)
diff --git a/spec/unit/puppet/type/anchor_spec.rb b/spec/unit/puppet/type/anchor_spec.rb
index f92065f..f92065f 100644..100755
--- a/spec/unit/puppet/type/anchor_spec.rb
+++ b/spec/unit/puppet/type/anchor_spec.rb
diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb
index 34d5dad..ab5b81b 100644..100755
--- a/spec/unit/puppet/type/file_line_spec.rb
+++ b/spec/unit/puppet/type/file_line_spec.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'tempfile'
describe Puppet::Type.type(:file_line) do