Sha256: 821c7a48a5e27fe4ad0ddfc45d287e19b8ef43cc902dbd0d3e41b8e79d280646

Contents?: true

Size: 890 Bytes

Versions: 5

Compression:

Stored size: 890 Bytes

Contents

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

%w{
  anchors errors escapes free_space groups literals
  meta properties quantifiers scripts sets types unicode_blocks
}.each do|tc|
  require File.expand_path("../test_#{tc}", __FILE__)
end

if RUBY_VERSION >= '2.0.0'
  %w{conditionals keep}.each do|tc|
    require File.expand_path("../test_#{tc}", __FILE__)
  end
end

class TestRegexpScanner < Test::Unit::TestCase

  def test_scanner_returns_an_array
    assert_instance_of( Array, RS.scan('abc') )
  end

  def test_scanner_returns_tokens_as_arrays
    tokens = RS.scan('^abc+[^one]{2,3}\b\d\\\C-C$')

    assert( tokens.all?{|token|
      token.kind_of?(Array) and token.length == 5
    }, "Not all tokens are arrays of 5 elements")
  end

  def test_scanner_token_count
    re = /^(one|two){2,3}([^d\]efm-qz\,\-]*)(ghi)+$/i

    assert_equal(26, RS.scan(re).length )
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
regexp_parser-0.3.4 test/scanner/test_all.rb
regexp_parser-0.3.3 test/scanner/test_all.rb
regexp_parser-0.3.2 test/scanner/test_all.rb
regexp_parser-0.3.1 test/scanner/test_all.rb
regexp_parser-0.3.0 test/scanner/test_all.rb