Sha256: d3b12594fd5a00c758c83b1d6bc0986e0f6c805b0cd263c7a76e0364307f940e

Contents?: true

Size: 727 Bytes

Versions: 5

Compression:

Stored size: 727 Bytes

Contents

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

class TestSyntaxTokenMap < Test::Unit::TestCase
  def test_syntax_token_map_complete
    map = Regexp::Syntax::Token::Map
    latest_syntax = Regexp::Syntax.new 'ruby/2.9'

    latest_syntax.features.each do |type, tokens|
      tokens.each do |token|
        assert map[type].include?(token),
               "`#{type} #{token}` implemented but missing from Map"
      end
    end
  end

  def test_syntax_token_map_uniq
    combinations = Regexp::Syntax::Token::Map.flat_map do |type, tokens|
      tokens.map { |token| "#{type} #{token}" }
    end

    non_uniq = combinations.group_by { |str| str }.select { |_, v| v.count > 1 }

    assert_empty non_uniq.keys
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
tdiary-5.0.13 vendor/bundle/gems/regexp_parser-1.3.0/test/syntax/test_syntax_token_map.rb
regexp_parser-1.4.0 test/syntax/test_syntax_token_map.rb
tdiary-5.0.12.1 vendor/bundle/gems/regexp_parser-1.3.0/test/syntax/test_syntax_token_map.rb
tdiary-5.0.11 vendor/bundle/gems/regexp_parser-1.3.0/test/syntax/test_syntax_token_map.rb
regexp_parser-1.3.0 test/syntax/test_syntax_token_map.rb