Sha256: bd54789d1136193c0cf1d4e1c01b34c1c8ce8c2ec667ab103ab570c611fb6fe6
Contents?: true
Size: 1.44 KB
Versions: 9
Compression:
Stored size: 1.44 KB
Contents
require File.expand_path("../../../helpers", __FILE__) class TestSyntaxRuby_V18 < Test::Unit::TestCase include Regexp::Syntax::Token def setup @syntax = Regexp::Syntax.new 'ruby/1.8' end tests = { :implements => { :assertion => [Assertion::Lookahead].flatten, :backref => [:number], :escape => [Escape::All].flatten, :group => [Group::All].flatten, :quantifier => [ Quantifier::Greedy + Quantifier::Reluctant + Quantifier::Interval + Quantifier::IntervalReluctant ].flatten, }, :excludes => { :assertion => [Assertion::Lookbehind].flatten, :backref => [ Backreference::All + SubexpressionCall::All ].flatten, :quantifier => [ Quantifier::Possessive ].flatten, :subset => nil }, } tests.each do |method, types| types.each do |type, tokens| if tokens.nil? or tokens.empty? define_method "test_syntax_ruby_v18_#{method}_#{type}" do assert_equal( method == :excludes ? false : true, @syntax.implements?(type, nil) ) end else tokens.each do |token| define_method "test_syntax_ruby_v18_#{method}_#{type}_#{token}" do assert_equal( method == :excludes ? false : true, @syntax.implements?(type, token) ) end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems