Sha256: c21fff6ecf8ba0bc2b89020ca25aa8ab1dd7f7a85cb20d83087e9d2c62fda510
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe 'EcmaReValidator::Anchors' do it 'should pass if regexp has no \A' do re = 'moby' expect(EcmaReValidator.valid?(re)).to eql(true) end it 'should pass if regexp is escaped \A' do re = 'moby\\\\A' expect(EcmaReValidator.valid?(re)).to eql(true) end it 'should fail if regexp is not escaped \A' do re = 'moby\\A' expect(EcmaReValidator.valid?(re)).to eql(false) end it 'should fail if regexp is not escaped \A, despite backslashes' do re = 'moby\\\\\\A' expect(EcmaReValidator.valid?(re)).to eql(false) end it 'should pass if regexp is escaped \A, with many backslashes' do re = 'moby\\\\\\\\A' expect(EcmaReValidator.valid?(re)).to eql(true) end it 'should pass if regexp has no \Z' do re = 'dick' expect(EcmaReValidator.valid?(re)).to eql(true) end it 'should pass if regexp is escaped \Z' do re = 'dick\\\\A' expect(EcmaReValidator.valid?(re)).to eql(true) end it 'should fail if regexp is not escaped \Z' do re = 'dick\\A' expect(EcmaReValidator.valid?(re)).to eql(false) end it 'should fail if regexp is not escaped \Z, despite backslashes' do re = 'moby\\\\\\Z' expect(EcmaReValidator.valid?(re)).to eql(false) end it 'should pass if regexp is escaped \Z, with many backslashes' do re = 'moby\\\\\\\\Z' expect(EcmaReValidator.valid?(re)).to eql(true) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecma-re-validator-0.1.1 | spec/anchors_spec.rb |
ecma-re-validator-0.1.0 | spec/anchors_spec.rb |