Use a BINARY encoded string when doing read/write comparisons.
This is a bit of a cheat really, but `#read` returns an ASCII encoded string, where as our ruby generates UTF-8 encoded strings, causing assertion failures. Fixes #20
This commit is contained in:
@@ -6,6 +6,7 @@ class TestServeMode < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
super
|
||||
@b = String.new("\xFF", ecoding: "BINARY")
|
||||
@env = Environment.new
|
||||
@env.writefile1( "0" )
|
||||
@env.serve1
|
||||
@@ -53,18 +54,18 @@ class TestServeMode < Test::Unit::TestCase
|
||||
assert_equal FlexNBD::REPLY_MAGIC, rsp[:magic]
|
||||
assert_equal 0, rsp[:error]
|
||||
|
||||
client.write( 0, "\xFF" )
|
||||
client.write( 0, @b )
|
||||
rsp = client.read_response
|
||||
assert_equal FlexNBD::REPLY_MAGIC, rsp[:magic]
|
||||
assert_equal 0, rsp[:error]
|
||||
|
||||
client.write( 0, "\xFF\xFF" )
|
||||
client.write( 0, @b * 2 )
|
||||
rsp = client.read_response
|
||||
assert_equal FlexNBD::REPLY_MAGIC, rsp[:magic]
|
||||
assert_equal 0, rsp[:error]
|
||||
end
|
||||
|
||||
assert_equal "\xFF\xFF", @env.file1.read( 0, 2 )
|
||||
assert_equal @b * 2, @env.file1.read( 0, 2 )
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user