Sha256: 2f8ea30631244d6e8db9a95ef3d803fadf8e87cfe98878b182cf0caf89d0fc43

Contents?: true

Size: 828 Bytes

Versions: 25

Compression:

Stored size: 828 Bytes

Contents

require File.expand_path("../../helpers", __FILE__)

class ScannerKeep < Test::Unit::TestCase

  def test_scan_keep_token
    tokens = RS.scan(/ab\Kcd/)
    result = tokens.at(1)

    assert_equal :keep, result[0]
    assert_equal :mark, result[1]
    assert_equal '\\K', result[2]
    assert_equal 2,     result[3]
    assert_equal 4,     result[4]
  end

  def test_scan_keep_nested
    tokens = RS.scan(/(a\Kb)|(c\\\Kd)ef/)

    first  = tokens.at(2)
    second = tokens.at(9)

    assert_equal :keep, first[0]
    assert_equal :mark, first[1]
    assert_equal '\\K', first[2]
    assert_equal 2,     first[3]
    assert_equal 4,     first[4]

    assert_equal :keep, second[0]
    assert_equal :mark, second[1]
    assert_equal '\\K', second[2]
    assert_equal 11,    second[3]
    assert_equal 13,    second[4]
  end

end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
tdiary-5.0.13 vendor/bundle/gems/regexp_parser-1.3.0/test/scanner/test_keep.rb
regexp_parser-1.4.0 test/scanner/test_keep.rb
tdiary-5.0.12.1 vendor/bundle/gems/regexp_parser-1.3.0/test/scanner/test_keep.rb
tdiary-5.0.11 vendor/bundle/gems/regexp_parser-1.3.0/test/scanner/test_keep.rb
regexp_parser-1.3.0 test/scanner/test_keep.rb
regexp_parser-1.2.0 test/scanner/test_keep.rb
regexp_parser-1.1.0 test/scanner/test_keep.rb
regexp_parser-1.0.0 test/scanner/test_keep.rb
regexp_parser-0.5.0 test/scanner/test_keep.rb
regexp_parser-0.4.13 test/scanner/test_keep.rb
regexp_parser-0.4.12 test/scanner/test_keep.rb
regexp_parser-0.4.11 test/scanner/test_keep.rb
regexp_parser-0.4.10 test/scanner/test_keep.rb
regexp_parser-0.4.9 test/scanner/test_keep.rb
regexp_parser-0.4.8 test/scanner/test_keep.rb
regexp_parser-0.4.7 test/scanner/test_keep.rb
regexp_parser-0.4.6 test/scanner/test_keep.rb
regexp_parser-0.4.5 test/scanner/test_keep.rb
regexp_parser-0.4.4 test/scanner/test_keep.rb
regexp_parser-0.4.3 test/scanner/test_keep.rb