Sha256: 71e6cc543392816190b886051cc6f7469490ca9dacd8e8ecafad5d4dc8025203

Contents?: true

Size: 1.13 KB

Versions: 20

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

RSpec.describe('Parsing errors') do
  let(:parser) { Regexp::Parser.new }
  before { parser.parse(/foo/) } # initializes ivars

  it('raises UnknownTokenTypeError for unknown token types') do
    expect { parser.send(:parse_token, Regexp::Token.new(:foo, :bar)) }
      .to raise_error(Regexp::Parser::UnknownTokenTypeError)
  end

  RSpec.shared_examples 'UnknownTokenError' do |type|
    it "raises for unkown tokens of type #{type}" do
      expect { parser.send(:parse_token, Regexp::Token.new(type, :foo)) }
        .to raise_error(Regexp::Parser::UnknownTokenError)
    end
  end

  include_examples 'UnknownTokenError', :anchor
  include_examples 'UnknownTokenError', :backref
  include_examples 'UnknownTokenError', :conditional
  include_examples 'UnknownTokenError', :free_space
  include_examples 'UnknownTokenError', :group
  include_examples 'UnknownTokenError', :meta
  include_examples 'UnknownTokenError', :nonproperty
  include_examples 'UnknownTokenError', :property
  include_examples 'UnknownTokenError', :quantifier
  include_examples 'UnknownTokenError', :set
  include_examples 'UnknownTokenError', :type
end

Version data entries

20 entries across 14 versions & 6 rubygems

Version Path
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/regexp_parser-2.2.0/spec/parser/errors_spec.rb
regexp_parser-2.2.0 spec/parser/errors_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.0.3/spec/parser/errors_spec.rb
cocRb-0.1.0 .bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.0.3/spec/parser/errors_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/parser/errors_spec.rb
regexp_parser-2.1.1 spec/parser/errors_spec.rb
regexp_parser-2.1.0 spec/parser/errors_spec.rb
regexp_parser-2.0.3 spec/parser/errors_spec.rb
regexp_parser-2.0.2 spec/parser/errors_spec.rb