summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/parser/scope.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/parser/scope.rb b/spec/unit/parser/scope.rb
index fa76c4ff2..13559528b 100755
--- a/spec/unit/parser/scope.rb
+++ b/spec/unit/parser/scope.rb
@@ -81,7 +81,21 @@ describe Puppet::Parser::Scope do
Puppet::Parser::Scope.number?("0755").should == 0755
end
+ it "should return nil on malformed integers" do
+ Puppet::Parser::Scope.number?("0.24.5").should be_nil
+ end
+
+ it "should convert strings with leading 0 to integer if they are not octal" do
+ Puppet::Parser::Scope.number?("0788").should == 788
+ end
+ it "should convert strings of negative integers" do
+ Puppet::Parser::Scope.number?("-0788").should == -788
+ end
+
+ it "should return nil on malformed hexadecimal numbers" do
+ Puppet::Parser::Scope.number?("0x89g").should be_nil
+ end
end
end