Sha256: c6f4dd199e307eb423ae2e521f298663736b091ac83b2229e6db09986a6c1dea

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

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

class ScannerUnicodeScripts < Test::Unit::TestCase

  tests = {
    'Aghb'	                  => :caucasian_albanian,
    'Caucasian Albanian'	    => :caucasian_albanian,

    'Arab'	                  => :arabic,
    'Arabic'	                => :arabic,

    'Armi'	                  => :imperial_aramaic,
    'Imperial Aramaic'        => :imperial_aramaic,

    'Egyp'                    => :egyptian_hieroglyphs,
    'Egyptian Hieroglyphs'    => :egyptian_hieroglyphs, # test whitespace

    'Linb'                    => :linear_b,
    'Linear-B'                => :linear_b, # test dash

    'Yiii'                    => :yi,
    'Yi'                      => :yi,

    'Zinh'                    => :inherited,
    'Inherited'               => :inherited,
    'Qaai'                    => :inherited,

    'Zyyy'                    => :common,
    'Common'                  => :common,

    'Zzzz'                    => :unknown,
    'Unknown'                 => :unknown,
  }

  tests.each_with_index do |(property, token), count|
    define_method "test_scanner_property_#{token}_#{count}" do
      tokens = RS.scan("a\\p{#{property}}c")
      result = tokens.at(1)

      assert_equal :property, result[0]
      assert_equal token,     result[1]
    end

    define_method "test_scanner_nonproperty_#{token}_#{count}" do
      tokens = RS.scan("a\\P{#{property}}c")
      result = tokens.at(1)

      assert_equal :nonproperty, result[0]
      assert_equal token,        result[1]
    end
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
tdiary-5.0.13 vendor/bundle/gems/regexp_parser-1.3.0/test/scanner/test_scripts.rb
regexp_parser-1.4.0 test/scanner/test_scripts.rb
tdiary-5.0.12.1 vendor/bundle/gems/regexp_parser-1.3.0/test/scanner/test_scripts.rb
tdiary-5.0.11 vendor/bundle/gems/regexp_parser-1.3.0/test/scanner/test_scripts.rb
regexp_parser-1.3.0 test/scanner/test_scripts.rb
regexp_parser-1.2.0 test/scanner/test_scripts.rb
regexp_parser-1.1.0 test/scanner/test_scripts.rb
regexp_parser-1.0.0 test/scanner/test_scripts.rb