Sha256: b9baa05eddf854cb40bf2f9b3c1999a30820bfd0f5e73166b9ca272ac7a37537

Contents?: true

Size: 644 Bytes

Versions: 25

Compression:

Stored size: 644 Bytes

Contents

# encoding: UTF-8

require File.expand_path("./helper", File.dirname(__FILE__))

prepare.clear

test "String#lines should return the parts when separated with \\n" do
  assert ["a\n", "b\n", "c\n"] == "a\nb\nc\n".lines.to_a
end

test "String#lines return the parts when separated with \\r\\n" do
  assert ["a\r\n", "b\r\n", "c\r\n"] == "a\r\nb\r\nc\r\n".lines.to_a
end

test "String#lines accept a record separator" do
  assert ["ax", "bx", "cx"] == "axbxcx".lines("x").to_a
end

test "String#lines execute the passed block" do
  lines = ["a\r\n", "b\r\n", "c\r\n"]

  "a\r\nb\r\nc\r\n".lines do |line|
    assert lines.shift == line
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ohm-1.4.0 test/1.8.6_test.rb
ohm-1.3.2 test/1.8.6_test.rb
ohm-1.3.1 test/1.8.6_test.rb
ohm-1.3.0 test/1.8.6_test.rb
ohm-1.2.0 test/1.8.6_test.rb
ohm-1.1.2 test/1.8.6_test.rb
ohm-1.1.1 test/1.8.6_test.rb
ohm-1.1.0 test/1.8.6_test.rb
ohm-1.1.0.rc1 test/1.8.6_test.rb
ohm-1.0.2 test/1.8.6_test.rb
ohm-1.0.1 test/1.8.6_test.rb
ohm-1.0.0 test/1.8.6_test.rb
ohm-1.0.0.rc4 test/1.8.6_test.rb
ohm-1.0.0.rc3 test/1.8.6_test.rb
ohm-1.0.0.rc2 test/1.8.6_test.rb
ohm-1.0.0.rc1 test/1.8.6_test.rb
ohm-1.0.0.alpha2 test/1.8.6_test.rb
ohm-1.0.0.alpha1 test/1.8.6_test.rb
ohm-0.1.5 test/1.8.6_test.rb
ohm-0.1.4 test/1.8.6_test.rb