2015-12-16 05:07:31 +00:00
|
|
|
# frozen_string_literal: false
|
2013-07-09 12:41:26 +00:00
|
|
|
require "rexml/text"
|
|
|
|
|
2014-05-27 12:07:40 +00:00
|
|
|
module REXMLTests
|
2014-05-27 13:10:55 +00:00
|
|
|
class TextTester < Test::Unit::TestCase
|
|
|
|
include REXML
|
2013-07-09 12:41:26 +00:00
|
|
|
|
2014-05-27 13:10:55 +00:00
|
|
|
def test_shift_operator_chain
|
|
|
|
text = Text.new("original\r\n")
|
|
|
|
text << "append1\r\n" << "append2\r\n"
|
|
|
|
assert_equal("original\nappend1\nappend2\n", text.to_s)
|
|
|
|
end
|
2013-07-09 12:41:26 +00:00
|
|
|
|
2014-05-27 13:10:55 +00:00
|
|
|
def test_shift_operator_cache
|
|
|
|
text = Text.new("original\r\n")
|
|
|
|
text << "append1\r\n" << "append2\r\n"
|
|
|
|
assert_equal("original\nappend1\nappend2\n", text.to_s)
|
|
|
|
text << "append3\r\n" << "append4\r\n"
|
|
|
|
assert_equal("original\nappend1\nappend2\nappend3\nappend4\n", text.to_s)
|
|
|
|
end
|
2013-07-09 12:41:26 +00:00
|
|
|
end
|
|
|
|
end
|