Sha256: e447f50c66bb451fa8046948aed08b2dff88b022e41afa298a41d47b532dfb24

Contents?: true

Size: 738 Bytes

Versions: 8

Compression:

Stored size: 738 Bytes

Contents

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

class TestParserPosixClasses < Test::Unit::TestCase
  def test_parse_posix_class
    root = RP.parse('[[:word:]]')
    exp  = root[0][0]

    assert_equal PosixClass, exp.class
    assert_equal :posixclass, exp.type
    assert_equal :word, exp.token
    assert_equal 'word', exp.name
    assert_equal '[:word:]', exp.text
    refute       exp.negative?
  end

  def test_parse_negative_posix_class
    root = RP.parse('[[:^word:]]')
    exp  = root[0][0]

    assert_equal PosixClass, exp.class
    assert_equal :nonposixclass, exp.type
    assert_equal :word, exp.token
    assert_equal 'word', exp.name
    assert_equal '[:^word:]', exp.text
    assert       exp.negative?
  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/parser/test_posix_classes.rb
regexp_parser-1.4.0 test/parser/test_posix_classes.rb
tdiary-5.0.12.1 vendor/bundle/gems/regexp_parser-1.3.0/test/parser/test_posix_classes.rb
tdiary-5.0.11 vendor/bundle/gems/regexp_parser-1.3.0/test/parser/test_posix_classes.rb
regexp_parser-1.3.0 test/parser/test_posix_classes.rb
regexp_parser-1.2.0 test/parser/test_posix_classes.rb
regexp_parser-1.1.0 test/parser/test_posix_classes.rb
regexp_parser-1.0.0 test/parser/test_posix_classes.rb