File: match_spec.rb

package info (click to toggle)
jruby 9.4.8.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 89,244 kB
  • sloc: ruby: 548,574; java: 276,189; yacc: 25,873; ansic: 6,178; xml: 6,111; sh: 1,855; sed: 94; makefile: 78; jsp: 48; tcl: 40; exp: 12
file content (30 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require_relative '../../spec_helper'

describe "Kernel#=~" do
  ruby_version_is ''...'3.2' do
    it "returns nil matching any object" do
      o = Object.new

      suppress_warning do
        (o =~ /Object/).should   be_nil
        (o =~ 'Object').should   be_nil
        (o =~ Object).should     be_nil
        (o =~ Object.new).should be_nil
        (o =~ nil).should        be_nil
        (o =~ true).should       be_nil
      end
    end

    it "is deprecated" do
      -> do
        Object.new =~ /regexp/
      end.should complain(/deprecated Object#=~ is called on Object/, verbose: true)
    end
  end

  ruby_version_is '3.2' do
    it "is no longer defined" do
      Object.new.should_not.respond_to?(:=~)
    end
  end
end