summaryrefslogtreecommitdiffstats
path: root/spec/unit/util
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-10-18 12:01:29 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-10-18 12:01:29 -0700
commit19ae3dffa4e52e752149ce90ebf83f9055c2313b (patch)
treef5cf31b9d5c45a199dbb9795482efb08e3c8afb7 /spec/unit/util
parent2d13fdaac56bd5cd57444cc4447081649e18f487 (diff)
parente3fc5b95d133aee1ae3dc188e6c47e88786dfc6e (diff)
Merge commit '2.6.3rc1' into next
Diffstat (limited to 'spec/unit/util')
-rwxr-xr-xspec/unit/util/pson_spec.rb (renamed from spec/unit/util/json_spec.rb)17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/util/json_spec.rb b/spec/unit/util/pson_spec.rb
index 4f6cea997..d02d28517 100755
--- a/spec/unit/util/json_spec.rb
+++ b/spec/unit/util/pson_spec.rb
@@ -18,4 +18,21 @@ describe Puppet::Util::Pson do
pson.expects(:from_pson).with("mydata")
pson.pson_create("type" => "foo", "data" => "mydata")
end
+
+
+ {
+ 'foo' => '"foo"',
+ 1 => '1',
+ "\x80" => "\"\x80\"",
+ [] => '[]'
+ }.each { |str,pson|
+ it "should be able to encode #{str.inspect}" do
+ str.to_pson.should == pson
+ end
+ }
+
+ it "should be able to handle arbitrary binary data" do
+ bin_string = (1..20000).collect { |i| ((17*i+13*i*i) % 255).chr }.join
+ PSON.parse(%Q{{ "type": "foo", "data": #{bin_string.to_pson} }})["data"].should == bin_string
+ end
end