diff options
author | Ken Barber <ken@bob.sh> | 2011-07-28 18:10:16 +0100 |
---|---|---|
committer | Ken Barber <ken@bob.sh> | 2011-07-28 18:10:16 +0100 |
commit | 635ed82e5cae38b0ba82098c340cbeed70d483c3 (patch) | |
tree | 6da1b936dd267452c8f89711a518a3b5d6500f50 /spec/unit/parser | |
parent | 7efd6ec5819775226d669c15b58649d375f72959 (diff) | |
download | puppet-stdlib-635ed82e5cae38b0ba82098c340cbeed70d483c3.tar.gz puppet-stdlib-635ed82e5cae38b0ba82098c340cbeed70d483c3.tar.bz2 |
(#2) - unstubbed is_valid_ip_address
Diffstat (limited to 'spec/unit/parser')
-rw-r--r-- | spec/unit/parser/functions/is_valid_ip_address_spec.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/spec/unit/parser/functions/is_valid_ip_address_spec.rb b/spec/unit/parser/functions/is_valid_ip_address_spec.rb index ee53ee1..2883aaa 100644 --- a/spec/unit/parser/functions/is_valid_ip_address_spec.rb +++ b/spec/unit/parser/functions/is_valid_ip_address_spec.rb @@ -18,14 +18,28 @@ describe "the is_valid_ip_address function" do lambda { @scope.function_is_valid_ip_address([]) }.should( raise_error(Puppet::ParseError)) end - it "should return true if an IP address" do - result = @scope.function_is_valid_ip_address("1.2.3.4") + it "should return true if an IPv4 address" do + result = @scope.function_is_valid_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_valid_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_valid_ip_address(["fe00::1"]) result.should(eq(true)) end it "should return false if not valid" do - result = @scope.function_is_valid_ip_address("asdf") + result = @scope.function_is_valid_ip_address(["asdf"]) result.should(eq(false)) end + it "should return false if IP octets out of range" do + result = @scope.function_is_valid_ip_address(["1.1.1.300"]) + result.should(eq(false)) + end end |