Update stdlib
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / type3x_spec.rb
1 require 'spec_helper'
2
3 describe 'type3x' do
4   it "should exist" do
5     expect(Puppet::Parser::Functions.function("type3x")).to eq("function_type3x")
6   end
7
8   it "should raise a ParseError if there is less than 1 arguments" do
9     expect { scope.function_type3x([]) }.to( raise_error(Puppet::ParseError))
10   end
11
12   it "should return string when given a string" do
13     result = scope.function_type3x(["aaabbbbcccc"])
14     expect(result).to(eq('string'))
15   end
16
17   it "should return array when given an array" do
18     result = scope.function_type3x([["aaabbbbcccc","asdf"]])
19     expect(result).to(eq('array'))
20   end
21
22   it "should return hash when given a hash" do
23     result = scope.function_type3x([{"a"=>1,"b"=>2}])
24     expect(result).to(eq('hash'))
25   end
26
27   it "should return integer when given an integer" do
28     result = scope.function_type3x(["1"])
29     expect(result).to(eq('integer'))
30   end
31
32   it "should return float when given a float" do
33     result = scope.function_type3x(["1.34"])
34     expect(result).to(eq('float'))
35   end
36
37   it "should return boolean when given a boolean" do
38     result = scope.function_type3x([true])
39     expect(result).to(eq('boolean'))
40   end
41 end