mojolingo / sippy_cup

Create SIP load test scenarios the easy way
http://mojolingo.github.io/sippy_cup
MIT License
218 stars 78 forks source link

Write PCAP file in binary mode #46

Closed wdrexler closed 9 years ago

benlangfeld commented 10 years ago

Tests! :facepunch: :tongue:

benlangfeld commented 10 years ago

Did you ever figure out how to get tests in for this, @wdrexler?

bklang commented 9 years ago

I can't find a reliable way to test for it. I've tried manually producing a "broken" string using something like this:

require 'tempfile'
str = [212].pack 'c'
str.encoding # => #<Encoding:ASCII-8BIT>
file = Tempfile.new 'x'
file.write str # => 1

According to behavior I'm seeing in the app, the above should raise, but it doesn't. I don't know why.

However, this bug is real, and the fix works, so I'm going to merge this. If we can figure out how to test it later, we can revisit it.