test/test_blocker.rb in binaryparse-0.1.5 vs test/test_blocker.rb in binaryparse-0.1.6
- old
+ new
@@ -1,8 +1,8 @@
require 'blocker'
require 'stringio'
-#require 'test/unit' #unless defined? $ZENTEST and $ZENTEST
+require 'test/unit' #unless defined? $ZENTEST and $ZENTEST
class TestBlocker < Test::Unit::TestCase
class BBTest1 < BinaryBlocker::Blocker
has_one :foo, :int16
has_one :bar, :int32
@@ -437,6 +437,18 @@
t2 = BBTimeRecord.new(buf)
assert(t2)
assert_nil(t2.t)
end
+
+ class BBSpaceString < BinaryBlocker::Blocker
+ has_one :name, :sstring, :length => 10
+ has_one :last, :string, :length => 5
+ end
+
+ def test_space_string
+ buf = "Name Last "
+ ss = BBSpaceString.new(buf)
+ assert(ss)
+ assert_equal("Name", ss.name)
+ end
end