Sha256: ccc58dba1520684c21b5c5e3b885a6b25b5bc078ac76318e0373fe974eece5d3

Contents?: true

Size: 930 Bytes

Versions: 69

Compression:

Stored size: 930 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Kernel do
  describe ".RE2" do
    it "returns an RE2::Regexp instance given a pattern" do
      expect(RE2('w(o)(o)')).to be_a(RE2::Regexp)
    end

    it "returns an RE2::Regexp instance given a pattern and options" do
      re = RE2('w(o)(o)', case_sensitive: false)

      expect(re).not_to be_case_sensitive
    end

    it "accepts patterns containing null bytes" do
      re = RE2("a\0b")

      expect(re.pattern).to eq("a\0b")
    end

    it "raises an error if given an inappropriate type" do
      expect { RE2(nil) }.to raise_error(TypeError)
    end

    it "allows invalid patterns to be created" do
      re = RE2('???', log_errors: false)

      expect(re).to be_a(RE2::Regexp)
    end

    it "supports passing something that can be coerced to a String as input" do
      re = RE2(StringLike.new('w(o)(o)'))

      expect(re).to be_a(RE2::Regexp)
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
re2-2.14.0 spec/kernel_spec.rb
re2-2.14.0-x86_64-linux spec/kernel_spec.rb
re2-2.14.0-x86_64-darwin spec/kernel_spec.rb
re2-2.14.0-x86-mingw32 spec/kernel_spec.rb
re2-2.14.0-x86-linux spec/kernel_spec.rb
re2-2.14.0-x64-mingw32 spec/kernel_spec.rb
re2-2.14.0-x64-mingw-ucrt spec/kernel_spec.rb
re2-2.14.0-arm64-darwin spec/kernel_spec.rb
re2-2.14.0-arm-linux spec/kernel_spec.rb
re2-2.14.0-aarch64-linux spec/kernel_spec.rb
re2-2.13.2 spec/kernel_spec.rb
re2-2.13.2-x86_64-linux spec/kernel_spec.rb
re2-2.13.2-x86_64-darwin spec/kernel_spec.rb
re2-2.13.2-x86-mingw32 spec/kernel_spec.rb
re2-2.13.2-x86-linux spec/kernel_spec.rb
re2-2.13.2-x64-mingw32 spec/kernel_spec.rb
re2-2.13.2-x64-mingw-ucrt spec/kernel_spec.rb
re2-2.13.2-arm64-darwin spec/kernel_spec.rb
re2-2.13.2-arm-linux spec/kernel_spec.rb
re2-2.13.2-aarch64-linux spec/kernel_spec.rb