HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.2.10/test/rexml/test_text.rb
require "rexml/text"

module REXMLTests
  class TextTester < Test::Unit::TestCase
    include REXML

    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

    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
  end
end