indices_list = []
indices.each do |i|
+ i = i.to_s
if m = i.match(/^(\d+)(\.\.\.?|\-)(\d+)$/)
start = m[1].to_i
stop = m[3].to_i
pp = <<-EOS
$input = '-34.56'
$output = abs($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
pp = <<-EOS
$input = -34.56
$output = abs($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: Output: testarray/)
+ expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
end
end
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: Output: testarray/)
+ expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
end
end
end
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
+ it "should convert a given boolean, #{bool}, to 0" do
pp = <<-EOS
- $input = #{bool}
+ $input = "#{bool}"
$output = bool2num($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
end
['true', 't', '1', 'y', 'yes'].each do |bool|
- it 'should convert a given boolean, #{bool}, to 1' do
+ it "should convert a given boolean, #{bool}, to 1" do
pp = <<-EOS
- $input = #{bool}
+ $input = "#{bool}"
$output = bool2num($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
pp = <<-EOS
$input = [1,2,3,4]
$output = count($input)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
pp = <<-EOS
$input = [1,1,1,2]
$output = count($input, 1)
- notify { $output: }
+ notify { "$output": }
EOS
apply_manifest(pp, :catch_failures => true) do |r|
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'ensure_packages function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || fact('operatingsystem') != 'windows') do
describe 'success' do
it 'ensure_packages a package' do
apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/merge\[one\] is "1"/)
+ expect(r.stdout).to match(/merge\[one\] is ("1"|1)/)
expect(r.stdout).to match(/merge\[two\] is "dos"/)
- expect(r.stdout).to match(/merge\[three\] is {"five"=>"5"}/)
+ expect(r.stdout).to match(/merge\[three\] is {"five"=>("5"|5)}/)
end
end
end
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'type function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'type function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || !(is_future_parser_enabled?)) do
describe 'success' do
it 'types arrays' do
pp = <<-EOS
} else {
$two = '/bin/aoeu'
}
- validate_cmd($one,$two,"aoeu is dvorak)
+ validate_cmd($one,$two,"aoeu is dvorak")
EOS
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/aoeu is dvorak/)
$output = values($arg)
notice(inline_template('<%= @output.sort.inspect %>'))
EOS
+ if is_future_parser_enabled?
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 2, 3\]/)
+ else
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "2", "3"\]/)
+ end
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "2", "3"\]/)
end
end
describe 'failure' do
$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"\]\]/)
+ if is_future_parser_enabled?
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\], \[3, 7\], \[4, 8\]\]/)
+ else
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\], \["3", "7"\], \["4", "8"\]\]/)
+ end
end
it 'zips two arrays of numbers & bools together' do
pp = <<-EOS
$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\]\]/)
+ if is_future_parser_enabled?
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, true\], \[2, true\], \["three", false\], \[4, false\]\]/)
+ else
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", true\], \["2", true\], \["three", false\], \["4", false\]\]/)
+ end
end
it 'zips two arrays of numbers together and flattens them' do
# XXX This only tests the argument `true`, even though the following are valid:
$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"\]/)
+ if is_future_parser_enabled?
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[1, 5, 2, 6, 3, 7, 4, 8\]/)
+ else
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\["1", "5", "2", "6", "3", "7", "4", "8"\]/)
+ end
end
it 'handles unmatched length' do
# XXX Is this expected behavior?
$output = zip($one,$two)
notice(inline_template('<%= @output.inspect %>'))
EOS
-
- expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/)
+ if is_future_parser_enabled?
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\[1, 5\], \[2, 6\]\]/)
+ else
+ expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\[\["1", "5"\], \["2", "6"\]\]/)
+ end
end
end
describe 'failure' do
# Configure all nodes in nodeset
c.before :suite do
+ if ENV['FUTURE_PARSER'] == 'true'
+ default[:default_apply_opts] ||= {}
+ default[:default_apply_opts].merge!({:parser => 'future'})
+ end
hosts.each do |host|
if host['platform'] !~ /windows/i
copy_root_module_to(host, :source => proj_root, :module_name => 'stdlib')
end
+
end
hosts.each do |host|
if host['platform'] =~ /windows/i
end
end
end
+
+def is_future_parser_enabled?
+ if default[:default_apply_opts]
+ return default[:default_apply_opts][:parser] == 'future'
+ end
+ return false
+end