Sha256: 28790faa9fbc426dfd48e68ef822eea83d444576a4a3205888132a44c07bd3b8

Contents?: true

Size: 899 Bytes

Versions: 30

Compression:

Stored size: 899 Bytes

Contents

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

30 entries across 30 versions & 1 rubygems

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