summaryrefslogtreecommitdiff
path: root/test/scanners/ruby/regexp.in.rb
blob: e10e7a837c0123e1dc12c0659ccbe10f86ed9dee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Regexp or division?
some_string.to_i /\s+/
some_string.split / +/  this is a regexp after a division /
some_string.split / + /  this one, too /
some_string.split /- /  # and this one is a regexp without division

it "allows substitution to interact with other Regexp constructs" do
  str = "foo)|(bar"
  /(#{str})/.should == /(foo)|(bar)/
  
  str = "a"
  /[#{str}-z]/.should == /[a-z]/

  not_compliant_on(:ruby) do
    str = "J"
    re = /\c#{str}/.should == /\cJ/
  end
end