Sha256: d125585473e8d7bb8f9ca301c59e9b07a79597d47255784f68c2b95c5901d189

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

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

if RUBY_VERSION >= '2.5.0'
  %w{emojis}.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$')

    all_arrays = tokens.all? do |token|
      token.kind_of?(Array) and token.length == 5
    end

    assert all_arrays, '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.5.0 test/scanner/test_all.rb
regexp_parser-0.4.13 test/scanner/test_all.rb
regexp_parser-0.4.12 test/scanner/test_all.rb
regexp_parser-0.4.11 test/scanner/test_all.rb
regexp_parser-0.4.10 test/scanner/test_all.rb