Sha256: b123e4165cee85c9ed7582c9c37f1d324694b7e5ab695272350e71768b0246b4

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

require 'helper'

describe EM::WebSocket::MaskedString do
  it "should allow reading 4 byte mask and unmasking byte / bytes" do
    t = EM::WebSocket::MaskedString.new("\x00\x00\x00\x01\x00\x01\x00\x01")
    t.read_mask
    t.getbyte(3).should == 0x00
    t.getbytes(0, 4).should == "\x00\x01\x00\x00"
    t.getbytes(1, 3).should ==     "\x01\x00\x00"
  end

  it "should return nil from getbyte if index requested is out of range" do
    t = EM::WebSocket::MaskedString.new("\x00\x00\x00\x00\x53")
    t.read_mask
    t.getbyte(0).should == 0x53
    t.getbyte(1).should == nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-websocket-0.3.0 spec/unit/masking_spec.rb