Sha256: cfd0d28abe853aff424a5a4acdfa351991680541838b90f8def6bef46549e549
Contents?: true
Size: 581 Bytes
Versions: 1
Compression:
Stored size: 581 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe RuboCop::Cop::Style::PerlBackrefs do subject(:cop) { described_class.new } it 'registers an offense for $1' do inspect_source(cop, ['puts $1']) expect(cop.offenses.size).to eq(1) end it 'auto-corrects $1 to Regexp.last_match[1]' do new_source = autocorrect_source(cop, '$1') expect(new_source).to eq('Regexp.last_match[1]') end it 'auto-corrects #$1 to #{Regexp.last_match[1]}' do new_source = autocorrect_source(cop, '"#$1"') expect(new_source).to eq('"#{Regexp.last_match[1]}"') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.28.0 | spec/rubocop/cop/style/perl_backrefs_spec.rb |