Sha256: 2be3b3dd1ae4d29ecf399a273b2293d4afd13c86fe17e8fd25af8087d250f9fd

Contents?: true

Size: 538 Bytes

Versions: 6

Compression:

Stored size: 538 Bytes

Contents

require 'spec_helper'

describe 'EcmaReValidator::Conditionals' do
  it 'should pass if regexp is using just (?...)' do
    re = '(?:Aa)'

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

  it 'should fail if regexp is using complicated if-then-else' do
    re = '(?(?=condition)(then1|then2|then3)|(else1|else2|else3))'

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

  it 'should fail if regexp is using basic if-then-else' do
    re = 'b(?(1)c|d)'

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

Version data entries

6 entries across 6 versions & 1 rubygems

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