Commit ce38b8fd by Jake Boxer

Stop stripping 0123456789# in encode_io

parent 833ff584
......@@ -27,7 +27,9 @@ module Rumoji
sequence = if last_emoji.nil? || !last_emoji.codepoints.include?(codepoint)
if possible_emoji.empty?
[codepoint].pack("U")
last_codepoint = last_emoji && last_emoji.codepoints.first
sequence_codepoints = [last_codepoint, codepoint].compact
sequence_codepoints.pack("U" * sequence_codepoints.size)
else
multiple_codepoint_emoji = possible_emoji.select(&:multiple?)
if multiple_codepoint_emoji.empty?
......
......@@ -30,6 +30,13 @@ describe Rumoji do
Rumoji.encode_io(io).string.must_equal ":smile:"
end
it "keeps codepoints that match the beginnings of multi-codepoint emoji" do
text = "i like #hashtags and 1direction"
io = StringIO.new(text)
Rumoji.encode_io(io).string.must_equal text
end
describe "with multiple codepoints" do
it "transforms a stream" do
io1 = StringIO.new("#{@zero}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment