Sha256: 29081fae7be140382b24baa1e2060087ee5686924e6d50265512908219e42e3e

Contents?: true

Size: 644 Bytes

Versions: 6

Compression:

Stored size: 644 Bytes

Contents

require 'spec_helper'

describe 'EcmaReValidator::Lookbehind' do
  it 'should fail if regexp has a positive lookbehind' do
    re = '(?<=a)b'

    expect(EcmaReValidator.valid?(re)).to eql(false)
  end

  it 'should pass if regexp has an escaped positive lookbehind' do
    re = '\\(?<=a\\)b'

    expect(EcmaReValidator.valid?(re)).to eql(true)
  end

  it 'should fail if regexp has a negative lookbehind' do
    re = '(?<!a)b'

    expect(EcmaReValidator.valid?(re)).to eql(false)
  end

  it 'should pass if regexp has an escaped negative lookbehind' do
    re = '\\(?<!a\\)b'

    expect(EcmaReValidator.valid?(re)).to eql(true)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecma-re-validator-0.3.0 spec/lookbehind_spec.rb
ecma-re-validator-0.2.1 spec/lookbehind_spec.rb
ecma-re-validator-0.2.0 spec/lookbehind_spec.rb
ecma-re-validator-0.1.2 spec/lookbehind_spec.rb
ecma-re-validator-0.1.1 spec/lookbehind_spec.rb
ecma-re-validator-0.1.0 spec/lookbehind_spec.rb