summaryrefslogtreecommitdiff
path: root/spec/unit/parser
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/functions/abs_spec.rb31
-rwxr-xr-xspec/unit/parser/functions/bool2num_spec.rb31
-rwxr-xr-xspec/unit/parser/functions/capitalize_spec.rb26
-rwxr-xr-xspec/unit/parser/functions/chomp_spec.rb26
-rwxr-xr-xspec/unit/parser/functions/chop_spec.rb26
-rwxr-xr-xspec/unit/parser/functions/delete_at_spec.rb26
-rwxr-xr-xspec/unit/parser/functions/delete_spec.rb26
-rwxr-xr-xspec/unit/parser/functions/downcase_spec.rb31
-rwxr-xr-xspec/unit/parser/functions/empty_spec.rb31
-rwxr-xr-xspec/unit/parser/functions/flatten_spec.rb31
-rwxr-xr-xspec/unit/parser/functions/grep_spec.rb26
-rw-r--r--spec/unit/parser/functions/hash_spec.rb26
-rw-r--r--spec/unit/parser/functions/is_array_spec.rb36
-rw-r--r--spec/unit/parser/functions/is_domain_name_spec.rb56
-rw-r--r--spec/unit/parser/functions/is_float_spec.rb36
-rw-r--r--spec/unit/parser/functions/is_hash_spec.rb36
-rw-r--r--spec/unit/parser/functions/is_integer_spec.rb36
-rw-r--r--spec/unit/parser/functions/is_ip_address_spec.rb45
-rw-r--r--spec/unit/parser/functions/is_mac_address_spec.rb36
-rw-r--r--spec/unit/parser/functions/is_numeric_spec.rb36
-rw-r--r--spec/unit/parser/functions/is_string_spec.rb41
-rw-r--r--spec/unit/parser/functions/join_spec.rb26
-rw-r--r--spec/unit/parser/functions/keys_spec.rb26
-rwxr-xr-xspec/unit/parser/functions/kwalify_spec.rb62
-rw-r--r--spec/unit/parser/functions/lstrip_spec.rb26
-rw-r--r--spec/unit/parser/functions/member_spec.rb31
-rw-r--r--spec/unit/parser/functions/num2bool_spec.rb31
-rw-r--r--spec/unit/parser/functions/parsejson_spec.rb29
-rw-r--r--spec/unit/parser/functions/parseyaml_spec.rb31
-rw-r--r--spec/unit/parser/functions/prefix_spec.rb26
-rw-r--r--spec/unit/parser/functions/range_spec.rb31
-rw-r--r--spec/unit/parser/functions/reverse_spec.rb26
-rw-r--r--spec/unit/parser/functions/rstrip_spec.rb31
-rw-r--r--spec/unit/parser/functions/shuffle_spec.rb31
-rw-r--r--spec/unit/parser/functions/size_spec.rb31
-rw-r--r--spec/unit/parser/functions/sort_spec.rb31
-rw-r--r--spec/unit/parser/functions/squeeze_spec.rb31
-rw-r--r--spec/unit/parser/functions/str2bool_spec.rb31
-rw-r--r--spec/unit/parser/functions/strftime_spec.rb36
-rw-r--r--spec/unit/parser/functions/strip_spec.rb26
-rw-r--r--spec/unit/parser/functions/swapcase_spec.rb26
-rw-r--r--spec/unit/parser/functions/time_spec.rb36
-rw-r--r--spec/unit/parser/functions/type_spec.rb51
-rw-r--r--spec/unit/parser/functions/unique_spec.rb31
-rw-r--r--spec/unit/parser/functions/upcase_spec.rb31
-rw-r--r--spec/unit/parser/functions/values_at_spec.rb45
-rw-r--r--spec/unit/parser/functions/values_spec.rb30
-rw-r--r--spec/unit/parser/functions/zip_spec.rb26
48 files changed, 0 insertions, 1564 deletions
diff --git a/spec/unit/parser/functions/abs_spec.rb b/spec/unit/parser/functions/abs_spec.rb
deleted file mode 100755
index 65ba2e8..0000000
--- a/spec/unit/parser/functions/abs_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the abs function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("abs").should == "function_abs"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_abs([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should convert a negative number into a positive" do
- result = @scope.function_abs(["-34"])
- result.should(eq(34))
- end
-
- it "should do nothing with a positive number" do
- result = @scope.function_abs(["5678"])
- result.should(eq(5678))
- end
-
-end
diff --git a/spec/unit/parser/functions/bool2num_spec.rb b/spec/unit/parser/functions/bool2num_spec.rb
deleted file mode 100755
index d5da18c..0000000
--- a/spec/unit/parser/functions/bool2num_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the bool2num function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("bool2num").should == "function_bool2num"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should convert true to 1" do
- result = @scope.function_bool2num([true])
- result.should(eq(1))
- end
-
- it "should convert false to 0" do
- result = @scope.function_bool2num([false])
- result.should(eq(0))
- end
-
-end
diff --git a/spec/unit/parser/functions/capitalize_spec.rb b/spec/unit/parser/functions/capitalize_spec.rb
deleted file mode 100755
index 1c45821..0000000
--- a/spec/unit/parser/functions/capitalize_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the capitalize function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("capitalize").should == "function_capitalize"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should capitalize the beginning of a string" do
- result = @scope.function_capitalize(["abc"])
- result.should(eq("Abc"))
- end
-
-end
diff --git a/spec/unit/parser/functions/chomp_spec.rb b/spec/unit/parser/functions/chomp_spec.rb
deleted file mode 100755
index 0592115..0000000
--- a/spec/unit/parser/functions/chomp_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the chomp function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("chomp").should == "function_chomp"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_chomp([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should chomp the end of a string" do
- result = @scope.function_chomp(["abc\n"])
- result.should(eq("abc"))
- end
-
-end
diff --git a/spec/unit/parser/functions/chop_spec.rb b/spec/unit/parser/functions/chop_spec.rb
deleted file mode 100755
index 0c456a8..0000000
--- a/spec/unit/parser/functions/chop_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the chop function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("chop").should == "function_chop"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_chop([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should chop the end of a string" do
- result = @scope.function_chop(["asdf\n"])
- result.should(eq("asdf"))
- end
-
-end
diff --git a/spec/unit/parser/functions/delete_at_spec.rb b/spec/unit/parser/functions/delete_at_spec.rb
deleted file mode 100755
index 27db0c8..0000000
--- a/spec/unit/parser/functions/delete_at_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the delete_at function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("delete_at").should == "function_delete_at"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_delete_at([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should delete an item at specified location from an array" do
- result = @scope.function_delete_at([['a','b','c'],1])
- result.should(eq(['a','c']))
- end
-
-end
diff --git a/spec/unit/parser/functions/delete_spec.rb b/spec/unit/parser/functions/delete_spec.rb
deleted file mode 100755
index fab3230..0000000
--- a/spec/unit/parser/functions/delete_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the delete function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("delete").should == "function_delete"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_delete([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should delete an item from an array" do
- result = @scope.function_delete([['a','b','c'],'b'])
- result.should(eq(['a','c']))
- end
-
-end
diff --git a/spec/unit/parser/functions/downcase_spec.rb b/spec/unit/parser/functions/downcase_spec.rb
deleted file mode 100755
index 0bccd5f..0000000
--- a/spec/unit/parser/functions/downcase_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the downcase function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("downcase").should == "function_downcase"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_downcase([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should downcase a string" do
- result = @scope.function_downcase(["ASFD"])
- result.should(eq("asfd"))
- end
-
- it "should do nothing to a string that is already downcase" do
- result = @scope.function_downcase(["asdf asdf"])
- result.should(eq("asdf asdf"))
- end
-
-end
diff --git a/spec/unit/parser/functions/empty_spec.rb b/spec/unit/parser/functions/empty_spec.rb
deleted file mode 100755
index cb0021f..0000000
--- a/spec/unit/parser/functions/empty_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the empty function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("empty").should == "function_empty"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_empty([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return a true for an empty string" do
- result = @scope.function_empty([''])
- result.should(eq(true))
- end
-
- it "should return a false for a non-empty string" do
- result = @scope.function_empty(['asdf'])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/flatten_spec.rb b/spec/unit/parser/functions/flatten_spec.rb
deleted file mode 100755
index 7bedeb2..0000000
--- a/spec/unit/parser/functions/flatten_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the flatten function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("flatten").should == "function_flatten"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_flatten([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should flatten a complex data structure" do
- result = @scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]])
- result.should(eq(["a","b","c","d","e","f","g"]))
- end
-
- it "should do nothing to a structure that is already flat" do
- result = @scope.function_flatten([["a","b","c","d"]])
- result.should(eq(["a","b","c","d"]))
- end
-
-end
diff --git a/spec/unit/parser/functions/grep_spec.rb b/spec/unit/parser/functions/grep_spec.rb
deleted file mode 100755
index b1f647c..0000000
--- a/spec/unit/parser/functions/grep_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the grep function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("grep").should == "function_grep"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_grep([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should grep contents from an array" do
- result = @scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"])
- result.should(eq(["aaabbb","bbbccc"]))
- end
-
-end
diff --git a/spec/unit/parser/functions/hash_spec.rb b/spec/unit/parser/functions/hash_spec.rb
deleted file mode 100644
index 6d3d48c..0000000
--- a/spec/unit/parser/functions/hash_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the hash function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("hash").should == "function_hash"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_hash([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should convert an array to a hash" do
- result = @scope.function_hash([['a',1,'b',2,'c',3]])
- result.should(eq({'a'=>1,'b'=>2,'c'=>3}))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_array_spec.rb b/spec/unit/parser/functions/is_array_spec.rb
deleted file mode 100644
index 537595c..0000000
--- a/spec/unit/parser/functions/is_array_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_array function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_array").should == "function_is_array"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_array([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if passed an array" do
- result = @scope.function_is_array([[1,2,3]])
- result.should(eq(true))
- end
-
- it "should return false if passed a hash" do
- result = @scope.function_is_array([{'a'=>1}])
- result.should(eq(false))
- end
-
- it "should return false if passed a string" do
- result = @scope.function_is_array(["asdf"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_domain_name_spec.rb b/spec/unit/parser/functions/is_domain_name_spec.rb
deleted file mode 100644
index ec7c7f5..0000000
--- a/spec/unit/parser/functions/is_domain_name_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_domain_name function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_domain_name").should == "function_is_domain_name"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_domain_name([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if a valid domain name" do
- result = @scope.function_is_domain_name(["foo.bar.com"])
- result.should(be_true)
- end
-
- it "should allow domain parts to start with numbers" do
- result = @scope.function_is_domain_name(["3foo.2bar.com"])
- result.should(be_true)
- end
-
- it "should allow domain to end with a dot" do
- result = @scope.function_is_domain_name(["3foo.2bar.com."])
- result.should(be_true)
- end
-
- it "should allow a single part domain" do
- result = @scope.function_is_domain_name(["orange"])
- result.should(be_true)
- end
-
- it "should return false if domain parts start with hyphens" do
- result = @scope.function_is_domain_name(["-3foo.2bar.com"])
- result.should(be_false)
- end
-
- it "should return true if domain contains hyphens" do
- result = @scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"])
- result.should(be_true)
- end
-
- it "should return false if domain name contains spaces" do
- result = @scope.function_is_domain_name(["not valid"])
- result.should(be_false)
- end
-
-end
diff --git a/spec/unit/parser/functions/is_float_spec.rb b/spec/unit/parser/functions/is_float_spec.rb
deleted file mode 100644
index 55ba8cf..0000000
--- a/spec/unit/parser/functions/is_float_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_float function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_float").should == "function_is_float"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_float([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if a float" do
- result = @scope.function_is_float(["0.12"])
- result.should(eq(true))
- end
-
- it "should return false if a string" do
- result = @scope.function_is_float(["asdf"])
- result.should(eq(false))
- end
-
- it "should return false if an integer" do
- result = @scope.function_is_float(["3"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_hash_spec.rb b/spec/unit/parser/functions/is_hash_spec.rb
deleted file mode 100644
index 94364f5..0000000
--- a/spec/unit/parser/functions/is_hash_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_hash function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_hash").should == "function_is_hash"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_hash([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if passed a hash" do
- result = @scope.function_is_hash([{"a"=>1,"b"=>2}])
- result.should(eq(true))
- end
-
- it "should return false if passed an array" do
- result = @scope.function_is_hash([["a","b"]])
- result.should(eq(false))
- end
-
- it "should return false if passed a string" do
- result = @scope.function_is_hash(["asdf"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_integer_spec.rb b/spec/unit/parser/functions/is_integer_spec.rb
deleted file mode 100644
index faf6f2d..0000000
--- a/spec/unit/parser/functions/is_integer_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_integer function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_integer").should == "function_is_integer"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if an integer" do
- result = @scope.function_is_integer(["3"])
- result.should(eq(true))
- end
-
- it "should return false if a float" do
- result = @scope.function_is_integer(["3.2"])
- result.should(eq(false))
- end
-
- it "should return false if a string" do
- result = @scope.function_is_integer(["asdf"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_ip_address_spec.rb b/spec/unit/parser/functions/is_ip_address_spec.rb
deleted file mode 100644
index 98ce828..0000000
--- a/spec/unit/parser/functions/is_ip_address_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_ip_address function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if an IPv4 address" do
- result = @scope.function_is_ip_address(["1.2.3.4"])
- result.should(eq(true))
- end
-
- it "should return true if a full IPv6 address" do
- result = @scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
- result.should(eq(true))
- end
-
- it "should return true if a compressed IPv6 address" do
- result = @scope.function_is_ip_address(["fe00::1"])
- result.should(eq(true))
- end
-
- it "should return false if not valid" do
- result = @scope.function_is_ip_address(["asdf"])
- result.should(eq(false))
- end
-
- it "should return false if IP octets out of range" do
- result = @scope.function_is_ip_address(["1.1.1.300"])
- result.should(eq(false))
- end
-end
diff --git a/spec/unit/parser/functions/is_mac_address_spec.rb b/spec/unit/parser/functions/is_mac_address_spec.rb
deleted file mode 100644
index c9b9637..0000000
--- a/spec/unit/parser/functions/is_mac_address_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_mac_address function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if a valid mac address" do
- result = @scope.function_is_mac_address(["00:a0:1f:12:7f:a0"])
- result.should(eq(true))
- end
-
- it "should return false if octets are out of range" do
- result = @scope.function_is_mac_address(["00:a0:1f:12:7f:g0"])
- result.should(eq(false))
- end
-
- it "should return false if not valid" do
- result = @scope.function_is_mac_address(["not valid"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_numeric_spec.rb b/spec/unit/parser/functions/is_numeric_spec.rb
deleted file mode 100644
index 2191b7b..0000000
--- a/spec/unit/parser/functions/is_numeric_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_numeric function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_numeric").should == "function_is_numeric"
- end
-
- it "should raise a ParseError if there is less than 1 argument" do
- lambda { @scope.function_is_numeric([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if an integer" do
- result = @scope.function_is_numeric(["3"])
- result.should(eq(true))
- end
-
- it "should return true if a float" do
- result = @scope.function_is_numeric(["3.2"])
- result.should(eq(true))
- end
-
- it "should return false if a string" do
- result = @scope.function_is_numeric(["asdf"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/is_string_spec.rb b/spec/unit/parser/functions/is_string_spec.rb
deleted file mode 100644
index 4f3f5fd..0000000
--- a/spec/unit/parser/functions/is_string_spec.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the is_string function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("is_string").should == "function_is_string"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if a string" do
- result = @scope.function_is_string(["asdf"])
- result.should(eq(true))
- end
-
- it "should return false if an integer" do
- result = @scope.function_is_string(["3"])
- result.should(eq(false))
- end
-
- it "should return false if a float" do
- result = @scope.function_is_string(["3.23"])
- result.should(eq(false))
- end
-
- it "should return false if an array" do
- result = @scope.function_is_string([["a","b","c"]])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/join_spec.rb b/spec/unit/parser/functions/join_spec.rb
deleted file mode 100644
index 1b3dec8..0000000
--- a/spec/unit/parser/functions/join_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the join function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("join").should == "function_join"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_join([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should join an array into a string" do
- result = @scope.function_join([["a","b","c"], ":"])
- result.should(eq("a:b:c"))
- end
-
-end
diff --git a/spec/unit/parser/functions/keys_spec.rb b/spec/unit/parser/functions/keys_spec.rb
deleted file mode 100644
index 927be96..0000000
--- a/spec/unit/parser/functions/keys_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the keys function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("keys").should == "function_keys"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_keys([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return an array of keys when given a hash" do
- result = @scope.function_keys([{'a'=>1, 'b' => 2}])
- result.should(eq(['a','b']))
- end
-
-end
diff --git a/spec/unit/parser/functions/kwalify_spec.rb b/spec/unit/parser/functions/kwalify_spec.rb
deleted file mode 100755
index abdd529..0000000
--- a/spec/unit/parser/functions/kwalify_spec.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the kwalify function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("kwalify").should == "function_kwalify"
- end
-
- it "should raise a ParseError if there is less than 2 arguments" do
- lambda { @scope.function_kwalify([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should validate a simple array schema" do
- schema = {
- 'type' => 'seq',
- 'sequence' => [
- { 'type' => 'str' }
- ]
- }
- document = ['a','b','c']
- @scope.function_kwalify([schema, document])
- end
-
- it "should not validate a simple array schema when invalid" do
- schema = {
- 'type' => 'seq',
- 'sequence' => [
- { 'type' => 'str' }
- ]
- }
- document = ['a','b',{'a' => 'b'}]
- lambda { @scope.function_kwalify([schema, document]) }.should(raise_error(Puppet::ParseError))
- end
-
- it "should validate a hash schema" do
- schema = {
- 'type' => 'map',
- 'mapping' => {
- 'key1' => {
- 'type' => 'str',
- },
- 'key2' => {
- 'type' => 'str',
- },
- }
- }
- document = {
- 'key1' => 'b',
- 'key2' => 'c',
- }
- @scope.function_kwalify([schema, document])
- end
-
-end
diff --git a/spec/unit/parser/functions/lstrip_spec.rb b/spec/unit/parser/functions/lstrip_spec.rb
deleted file mode 100644
index ac331fa..0000000
--- a/spec/unit/parser/functions/lstrip_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the lstrip function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("lstrip").should == "function_lstrip"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_lstrip([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should lstrip a string" do
- result = @scope.function_lstrip([" asdf"])
- result.should(eq('asdf'))
- end
-
-end
diff --git a/spec/unit/parser/functions/member_spec.rb b/spec/unit/parser/functions/member_spec.rb
deleted file mode 100644
index 2cebc0d..0000000
--- a/spec/unit/parser/functions/member_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the member function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("member").should == "function_member"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_member([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if a member is in an array" do
- result = @scope.function_member([["a","b","c"], "a"])
- result.should(eq(true))
- end
-
- it "should return false if a member is not in an array" do
- result = @scope.function_member([["a","b","c"], "d"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/num2bool_spec.rb b/spec/unit/parser/functions/num2bool_spec.rb
deleted file mode 100644
index 6585273..0000000
--- a/spec/unit/parser/functions/num2bool_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the num2bool function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("num2bool").should == "function_num2bool"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return true if 1" do
- result = @scope.function_num2bool(["1"])
- result.should(be_true)
- end
-
- it "should return false if 0" do
- result = @scope.function_num2bool(["0"])
- result.should(be_false)
- end
-
-end
diff --git a/spec/unit/parser/functions/parsejson_spec.rb b/spec/unit/parser/functions/parsejson_spec.rb
deleted file mode 100644
index 26eea36..0000000
--- a/spec/unit/parser/functions/parsejson_spec.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the parsejson function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("parsejson").should == "function_parsejson"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should convert JSON to a data structure" do
- json = <<-EOS
-["aaa","bbb","ccc"]
-EOS
- result = @scope.function_parsejson([json])
- result.should(eq(['aaa','bbb','ccc']))
- end
-
-end
diff --git a/spec/unit/parser/functions/parseyaml_spec.rb b/spec/unit/parser/functions/parseyaml_spec.rb
deleted file mode 100644
index f9cb049..0000000
--- a/spec/unit/parser/functions/parseyaml_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the parseyaml function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should convert YAML to a data structure" do
- yaml = <<-EOS
-- aaa
-- bbb
-- ccc
-EOS
- result = @scope.function_parseyaml([yaml])
- result.should(eq(['aaa','bbb','ccc']))
- end
-
-end
diff --git a/spec/unit/parser/functions/prefix_spec.rb b/spec/unit/parser/functions/prefix_spec.rb
deleted file mode 100644
index a0cbcab..0000000
--- a/spec/unit/parser/functions/prefix_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the prefix function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("prefix").should == "function_prefix"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_prefix([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return a prefixed array" do
- result = @scope.function_prefix([['a','b','c'], 'p'])
- result.should(eq(['pa','pb','pc']))
- end
-
-end
diff --git a/spec/unit/parser/functions/range_spec.rb b/spec/unit/parser/functions/range_spec.rb
deleted file mode 100644
index 8c2446a..0000000
--- a/spec/unit/parser/functions/range_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the range function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("range").should == "function_range"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_range([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return a letter range" do
- result = @scope.function_range(["a","d"])
- result.should(eq(['a','b','c','d']))
- end
-
- it "should return a number range" do
- result = @scope.function_range(["1","4"])
- result.should(eq([1,2,3,4]))
- end
-
-end
diff --git a/spec/unit/parser/functions/reverse_spec.rb b/spec/unit/parser/functions/reverse_spec.rb
deleted file mode 100644
index 4fa50e4..0000000
--- a/spec/unit/parser/functions/reverse_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the reverse function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("reverse").should == "function_reverse"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_reverse([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should reverse a string" do
- result = @scope.function_reverse(["asdfghijkl"])
- result.should(eq('lkjihgfdsa'))
- end
-
-end
diff --git a/spec/unit/parser/functions/rstrip_spec.rb b/spec/unit/parser/functions/rstrip_spec.rb
deleted file mode 100644
index af8cc12..0000000
--- a/spec/unit/parser/functions/rstrip_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the rstrip function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("rstrip").should == "function_rstrip"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_rstrip([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should rstrip a string" do
- result = @scope.function_rstrip(["asdf "])
- result.should(eq('asdf'))
- end
-
- it "should rstrip each element in an array" do
- result = @scope.function_rstrip([["a ","b ", "c "]])
- result.should(eq(['a','b','c']))
- end
-
-end
diff --git a/spec/unit/parser/functions/shuffle_spec.rb b/spec/unit/parser/functions/shuffle_spec.rb
deleted file mode 100644
index f04fda5..0000000
--- a/spec/unit/parser/functions/shuffle_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the shuffle function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("shuffle").should == "function_shuffle"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should shuffle a string and the result should be the same size" do
- result = @scope.function_shuffle(["asdf"])
- result.size.should(eq(4))
- end
-
- it "should shuffle a string but the sorted contents should still be the same" do
- result = @scope.function_shuffle(["adfs"])
- result.split("").sort.join("").should(eq("adfs"))
- end
-
-end
diff --git a/spec/unit/parser/functions/size_spec.rb b/spec/unit/parser/functions/size_spec.rb
deleted file mode 100644
index ccaa335..0000000
--- a/spec/unit/parser/functions/size_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the size function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("size").should == "function_size"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_size([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return the size of a string" do
- result = @scope.function_size(["asdf"])
- result.should(eq(4))
- end
-
- it "should return the size of an array" do
- result = @scope.function_size([["a","b","c"]])
- result.should(eq(3))
- end
-
-end
diff --git a/spec/unit/parser/functions/sort_spec.rb b/spec/unit/parser/functions/sort_spec.rb
deleted file mode 100644
index fbe3073..0000000
--- a/spec/unit/parser/functions/sort_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the sort function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("sort").should == "function_sort"
- end
-
- it "should raise a ParseError if there is not 1 arguments" do
- lambda { @scope.function_sort(['','']) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should sort an array" do
- result = @scope.function_sort([["a","c","b"]])
- result.should(eq(['a','b','c']))
- end
-
- it "should sort a string" do
- result = @scope.function_sort(["acb"])
- result.should(eq('abc'))
- end
-
-end
diff --git a/spec/unit/parser/functions/squeeze_spec.rb b/spec/unit/parser/functions/squeeze_spec.rb
deleted file mode 100644
index 9355ad2..0000000
--- a/spec/unit/parser/functions/squeeze_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the squeeze function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("squeeze").should == "function_squeeze"
- end
-
- it "should raise a ParseError if there is less than 2 arguments" do
- lambda { @scope.function_squeeze([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should squeeze a string" do
- result = @scope.function_squeeze(["aaabbbbcccc"])
- result.should(eq('abc'))
- end
-
- it "should squeeze all elements in an array" do
- result = @scope.function_squeeze([["aaabbbbcccc","dddfff"]])
- result.should(eq(['abc','df']))
- end
-
-end
diff --git a/spec/unit/parser/functions/str2bool_spec.rb b/spec/unit/parser/functions/str2bool_spec.rb
deleted file mode 100644
index d7f0ac9..0000000
--- a/spec/unit/parser/functions/str2bool_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the str2bool function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("str2bool").should == "function_str2bool"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should convert string 'true' to true" do
- result = @scope.function_str2bool(["true"])
- result.should(eq(true))
- end
-
- it "should convert string 'undef' to false" do
- result = @scope.function_str2bool(["undef"])
- result.should(eq(false))
- end
-
-end
diff --git a/spec/unit/parser/functions/strftime_spec.rb b/spec/unit/parser/functions/strftime_spec.rb
deleted file mode 100644
index f7a2cd9..0000000
--- a/spec/unit/parser/functions/strftime_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the strftime function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("strftime").should == "function_strftime"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_strftime([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "using %s should be higher then when I wrote this test" do
- result = @scope.function_strftime(["%s"])
- result.to_i.should(be > 1311953157)
- end
-
- it "using %s should be lower then 1.5 trillion" do
- result = @scope.function_strftime(["%s"])
- result.to_i.should(be < 1500000000)
- end
-
- it "should return a date when given %Y-%m-%d" do
- result = @scope.function_strftime(["%Y-%m-%d"])
- result.should =~ /^\d{4}-\d{2}-\d{2}$/
- end
-
-end
diff --git a/spec/unit/parser/functions/strip_spec.rb b/spec/unit/parser/functions/strip_spec.rb
deleted file mode 100644
index 48a52dd..0000000
--- a/spec/unit/parser/functions/strip_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the strip function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("strip").should == "function_strip"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_strip([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should strip a string" do
- result = @scope.function_strip([" ab cd "])
- result.should(eq('ab cd'))
- end
-
-end
diff --git a/spec/unit/parser/functions/swapcase_spec.rb b/spec/unit/parser/functions/swapcase_spec.rb
deleted file mode 100644
index 2686054..0000000
--- a/spec/unit/parser/functions/swapcase_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the swapcase function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("swapcase").should == "function_swapcase"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_swapcase([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should swapcase a string" do
- result = @scope.function_swapcase(["aaBBccDD"])
- result.should(eq('AAbbCCdd'))
- end
-
-end
diff --git a/spec/unit/parser/functions/time_spec.rb b/spec/unit/parser/functions/time_spec.rb
deleted file mode 100644
index 666e8e0..0000000
--- a/spec/unit/parser/functions/time_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the time function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("time").should == "function_time"
- end
-
- it "should raise a ParseError if there is more than 2 arguments" do
- lambda { @scope.function_time(['','']) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return a number" do
- result = @scope.function_time([])
- result.class.should(eq(Fixnum))
- end
-
- it "should be higher then when I wrote this test" do
- result = @scope.function_time([])
- result.should(be > 1311953157)
- end
-
- it "should be lower then 1.5 trillion" do
- result = @scope.function_time([])
- result.should(be < 1500000000)
- end
-
-end
diff --git a/spec/unit/parser/functions/type_spec.rb b/spec/unit/parser/functions/type_spec.rb
deleted file mode 100644
index e3c28ed..0000000
--- a/spec/unit/parser/functions/type_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the type function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("type").should == "function_type"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_type([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return string when given a string" do
- result = @scope.function_type(["aaabbbbcccc"])
- result.should(eq('string'))
- end
-
- it "should return array when given an array" do
- result = @scope.function_type([["aaabbbbcccc","asdf"]])
- result.should(eq('array'))
- end
-
- it "should return hash when given a hash" do
- result = @scope.function_type([{"a"=>1,"b"=>2}])
- result.should(eq('hash'))
- end
-
- it "should return integer when given an integer" do
- result = @scope.function_type(["1"])
- result.should(eq('integer'))
- end
-
- it "should return float when given a float" do
- result = @scope.function_type(["1.34"])
- result.should(eq('float'))
- end
-
- it "should return boolean when given a boolean" do
- result = @scope.function_type([true])
- result.should(eq('boolean'))
- end
-
-end
diff --git a/spec/unit/parser/functions/unique_spec.rb b/spec/unit/parser/functions/unique_spec.rb
deleted file mode 100644
index 627dc33..0000000
--- a/spec/unit/parser/functions/unique_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the unique function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("unique").should == "function_unique"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_unique([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should remove duplicate elements in a string" do
- result = @scope.function_unique(["aabbc"])
- result.should(eq('abc'))
- end
-
- it "should remove duplicate elements in an array" do
- result = @scope.function_unique([["a","a","b","b","c"]])
- result.should(eq(['a','b','c']))
- end
-
-end
diff --git a/spec/unit/parser/functions/upcase_spec.rb b/spec/unit/parser/functions/upcase_spec.rb
deleted file mode 100644
index 5d18846..0000000
--- a/spec/unit/parser/functions/upcase_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the upcase function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("upcase").should == "function_upcase"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_upcase([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should upcase a string" do
- result = @scope.function_upcase(["abc"])
- result.should(eq('ABC'))
- end
-
- it "should do nothing if a string is already upcase" do
- result = @scope.function_upcase(["ABC"])
- result.should(eq('ABC'))
- end
-
-end
diff --git a/spec/unit/parser/functions/values_at_spec.rb b/spec/unit/parser/functions/values_at_spec.rb
deleted file mode 100644
index 6c45316..0000000
--- a/spec/unit/parser/functions/values_at_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the values_at function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("values_at").should == "function_values_at"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_values_at([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should raise a ParseError if you try to use a range where stop is greater then start" do
- lambda { @scope.function_values_at([['a','b'],["3-1"]]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return a value at from an array" do
- result = @scope.function_values_at([['a','b','c'],"1"])
- result.should(eq(['b']))
- end
-
- it "should return a value at from an array when passed a range" do
- result = @scope.function_values_at([['a','b','c'],"0-1"])
- result.should(eq(['a','b']))
- end
-
- it "should return chosen values from an array when passed number of indexes" do
- result = @scope.function_values_at([['a','b','c'],["0","2"]])
- result.should(eq(['a','c']))
- end
-
- it "should return chosen values from an array when passed ranges and multiple indexes" do
- result = @scope.function_values_at([['a','b','c','d','e','f','g'],["0","2","4-5"]])
- result.should(eq(['a','c','e','f']))
- end
-
-end
diff --git a/spec/unit/parser/functions/values_spec.rb b/spec/unit/parser/functions/values_spec.rb
deleted file mode 100644
index f6eb5b6..0000000
--- a/spec/unit/parser/functions/values_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the values function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("values").should == "function_values"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_values([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should return values from a hash" do
- result = @scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}])
- result.should(eq(['1','2','3']))
- end
-
- it "should return values from a hash" do
- lambda { @scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError))
- end
-
-end
diff --git a/spec/unit/parser/functions/zip_spec.rb b/spec/unit/parser/functions/zip_spec.rb
deleted file mode 100644
index 074f4df..0000000
--- a/spec/unit/parser/functions/zip_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env rspec
-require 'spec_helper'
-
-describe "the zip function" do
- before :all do
- Puppet::Parser::Functions.autoloader.loadall
- end
-
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
-
- it "should exist" do
- Puppet::Parser::Functions.function("zip").should == "function_zip"
- end
-
- it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_zip([]) }.should( raise_error(Puppet::ParseError))
- end
-
- it "should be able to zip an array" do
- result = @scope.function_zip([['1','2','3'],['4','5','6']])
- result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
- end
-
-end