Created
December 22, 2012 04:38
-
-
Save rking/4357513 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rspec' | |
def chop_at_crlf! data | |
data.sub! /(\r\n)(.*)/, '\1' | |
$2 | |
end | |
describe 'thing' do | |
it 'should parse' do | |
input = "PRIVMSG #notroll :this is a pretty standard message plus or minus the colon... i forget.\r\ntrash" | |
trash = chop_at_crlf! input | |
"PRIVMSG #notroll :this is a pretty standard message plus or minus the colon... i forget.\r\n".should == input | |
'trash'.should == trash | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'minitest/autorun' | |
def chop_at_crlf! data | |
data.sub! /(\r\n)(.*)/, '\1' | |
$2 | |
end | |
class IrcTest < MiniTest::Unit::TestCase | |
def test_parse | |
input = "PRIVMSG #notroll :this is a pretty standard message plus or minus the colon... i forget.\r\ntrash" | |
trash = chop_at_crlf! input | |
assert_equal "PRIVMSG #notroll :this is a pretty standard message plus or minus the colon... i forget.\r\n", input | |
assert_equal 'trash', trash | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment