Sha256: 33e92575969907b7ecd49953f190299954feb2872a82d14069fe8bf3da1ca642

Contents?: true

Size: 917 Bytes

Versions: 52

Compression:

Stored size: 917 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe "Literal Regexps" do
  it 'supports (?<= ) (positive lookbehind)' do
    /foo.(?<=\d)/.match("fooA foo1").to_a.should == ["foo1"]
  end

  it 'supports (?<! ) (negative lookbehind)' do
    /foo.(?<!\d)/.match("foo1 fooA").to_a.should == ["fooA"]
  end

  it 'supports \g (named backreference)' do
    /(?<foo>foo.)bar\g<foo>/.match("foo1barfoo2").to_a.should == ["foo1barfoo2", "foo2"]
  end

  it 'supports character class composition' do
    /[a-z&&[^a-c]]+/.match("abcdef").to_a.should == ["def"]
    /[a-z&&[^d-i&&[^d-f]]]+/.match("abcdefghi").to_a.should == ["abcdef"]
  end

  it 'supports possessive quantifiers' do
    /fooA++bar/.match("fooAAAbar").to_a.should == ["fooAAAbar"]

    /fooA++Abar/.match("fooAAAbar").should be_nil
    /fooA?+Abar/.match("fooAAAbar").should be_nil
    /fooA*+Abar/.match("fooAAAbar").should be_nil
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-7.5.1 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-7.4.1 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-7.1.17 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-6.2.0 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-6.0.11 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.18 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.17 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.15 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.2 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-5.5.0 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-3.3.5 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb
rhodes-3.4.2 spec/framework_spec/app/spec/language/versions/regexp_1.9.rb