Permalink
Browse files

Port pack, unpack specs for 'P' to new specs.

  • Loading branch information...
1 parent f892140 commit 91257ff2cba19ece73b2965fff34a977a0db285a Brian Ford committed with brixen Sep 9, 2011
Showing with 15 additions and 0 deletions.
  1. +7 −0 core/array/pack/p_spec.rb
  2. +8 −0 core/string/unpack/p_spec.rb
@@ -0,0 +1,7 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+describe "Array#pack with format 'P'" do
+ it "returns a String whose size is the number of bytes in a mochine word" do
+ [nil].pack("P").size.should == 1.size
+ end
+end
@@ -0,0 +1,8 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+describe "String#unpack with format 'P'" do
+ it "returns a random object after consuming a size-of a machine word bytes" do
+ str = "\0" * 1.size
+ str.unpack("P").should be_kind_of(Object)
+ end
+end

0 comments on commit 91257ff

Please sign in to comment.