Skip to content

Commit

Permalink
Fix line continuations in spec examples
Browse files Browse the repository at this point in the history
Fix backslash before newline.
  • Loading branch information
biinari authored and bbatsov committed Aug 6, 2020
1 parent d0bee92 commit dfbbdd0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def investigate(processed_source)
end

it 'does not check binary operations when string wrapped with backslash' do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
flash[:error] = 'Here is a string ' \
'That spans' <<
'multiple lines'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def config_to_allow_offenses

it 'registers an offense and corrects misaligned string operand ' \
'when the first operand has backslash continuation' do
expect_offense(<<~RUBY)
expect_offense(<<~'RUBY')
def f
flash[:error] = 'Here is a string ' \
'That spans' <<
Expand All @@ -334,7 +334,7 @@ def f
end
RUBY

expect_correction(<<~RUBY)
expect_correction(<<~'RUBY')
def f
flash[:error] = 'Here is a string ' \
'That spans' <<
Expand Down Expand Up @@ -459,7 +459,7 @@ def f
end

it 'accepts the indentation of a broken string' do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
MSG = 'Use 2 (not %d) spaces for indenting a ' \
'broken line.'
RUBY
Expand Down
8 changes: 4 additions & 4 deletions spec/rubocop/cop/style/redundant_percent_q_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
end

it 'auto-corrects for strings that is concated with backslash' do
new_source = autocorrect_source(<<~RUBY)
new_source = autocorrect_source(<<~'RUBY')
%q(foo bar baz) \
'boogers'
RUBY
expect(new_source).to eq(<<~RUBY)
expect(new_source).to eq(<<~'RUBY')
'foo bar baz' \
'boogers'
RUBY
Expand Down Expand Up @@ -142,11 +142,11 @@
end

it 'auto-corrects for strings that is concated with backslash' do
new_source = autocorrect_source(<<~RUBY)
new_source = autocorrect_source(<<~'RUBY')
%Q(foo bar baz) \
'boogers'
RUBY
expect(new_source).to eq(<<~RUBY)
expect(new_source).to eq(<<~'RUBY')
"foo bar baz" \
'boogers'
RUBY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
end

it 'accepts double quotes on a broken static string' do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
"A" \
"B"
RUBY
Expand Down
8 changes: 4 additions & 4 deletions spec/rubocop/cop/style/string_literals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
end

it 'accepts continued strings using all single quotes' do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
'abc' \
'def'
RUBY
Expand Down Expand Up @@ -330,7 +330,7 @@
end

it "doesn't register offense for double quotes with embedded single" do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
"abc'" \
"def"
RUBY
Expand Down Expand Up @@ -369,7 +369,7 @@
end

it 'accepts continued strings using all double quotes' do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
"abc" \
"def"
RUBY
Expand All @@ -392,7 +392,7 @@
end

it "doesn't register offense for single quotes with embedded double" do
expect_no_offenses(<<~RUBY)
expect_no_offenses(<<~'RUBY')
'abc"' \
'def'
RUBY
Expand Down

0 comments on commit dfbbdd0

Please sign in to comment.