Sha256: 2045a27d65b9c5a2abff5e2701335ff83308ccc34b1fa5eace7742465b6e72f9

Contents?: true

Size: 1.62 KB

Versions: 51

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

RSpec.describe(Regexp::Syntax) do
  specify('unknown name') do
    expect { Regexp::Syntax.new('ruby/1.0') }.to raise_error(Regexp::Syntax::UnknownSyntaxNameError)
  end

  specify('new') do
    expect(Regexp::Syntax.new('ruby/1.9.3')).to be_instance_of(Regexp::Syntax::V1_9_3)
  end

  specify('new any') do
    expect(Regexp::Syntax.new('any')).to be_instance_of(Regexp::Syntax::Any)
    expect(Regexp::Syntax.new('*')).to be_instance_of(Regexp::Syntax::Any)
  end

  specify('not implemented') do
    expect { RP.parse('\\p{alpha}', 'ruby/1.8') }.to raise_error(Regexp::Syntax::NotImplementedError)
  end

  specify('supported?') do
    expect(Regexp::Syntax.supported?('ruby/1.1.1')).to be false
    expect(Regexp::Syntax.supported?('ruby/2.4.3')).to be true
    expect(Regexp::Syntax.supported?('ruby/2.5')).to be true
  end

  specify('invalid version') do
    expect { Regexp::Syntax.version_class('2.0.0') }.to raise_error(Regexp::Syntax::InvalidVersionNameError)

    expect { Regexp::Syntax.version_class('ruby/20') }.to raise_error(Regexp::Syntax::InvalidVersionNameError)
  end

  specify('version class tiny version') do
    expect(Regexp::Syntax.version_class('ruby/1.9.3')).to eq Regexp::Syntax::V1_9_3

    expect(Regexp::Syntax.version_class('ruby/2.3.1')).to eq Regexp::Syntax::V2_3_1
  end

  specify('version class minor version') do
    expect(Regexp::Syntax.version_class('ruby/1.9')).to eq Regexp::Syntax::V1_9

    expect(Regexp::Syntax.version_class('ruby/2.3')).to eq Regexp::Syntax::V2_3
  end

  specify('raises for unknown constant lookups') do
    expect { Regexp::Syntax::V1 }.to raise_error(/V1/)
  end
end

Version data entries

51 entries across 38 versions & 10 rubygems

Version Path
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/regexp_parser-1.8.0/spec/syntax/syntax_spec.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/regexp_parser-1.8.0/spec/syntax/syntax_spec.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/regexp_parser-1.8.0/spec/syntax/syntax_spec.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/regexp_parser-1.8.0/spec/syntax/syntax_spec.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/regexp_parser-2.2.0/spec/syntax/syntax_spec.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/regexp_parser-1.8.0/spec/syntax/syntax_spec.rb
regexp_parser-2.2.0 spec/syntax/syntax_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/regexp_parser-1.8.0/spec/syntax/syntax_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_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/syntax/syntax_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/syntax/syntax_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/regexp_parser-1.8.2/spec/syntax/syntax_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/regexp_parser-2.1.1/spec/syntax/syntax_spec.rb