diff options
Diffstat (limited to 'spec/hunk_spec.rb')
-rw-r--r-- | spec/hunk_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/hunk_spec.rb b/spec/hunk_spec.rb index 0711e0d..5a45072 100644 --- a/spec/hunk_spec.rb +++ b/spec/hunk_spec.rb @@ -1,4 +1,4 @@ -# -*- ruby encoding: utf-8 -*- +# frozen_string_literal: true require 'spec_helper' @@ -6,52 +6,52 @@ if String.method_defined?(:encoding) require 'diff/lcs/hunk' describe Diff::LCS::Hunk do - let(:old_data) { ["Tu avec carté {count} itém has".encode('UTF-16LE')] } - let(:new_data) { ["Tu avec carte {count} item has".encode('UTF-16LE')] } + let(:old_data) { ['Tu avec carté {count} itém has'.encode('UTF-16LE')] } + let(:new_data) { ['Tu avec carte {count} item has'.encode('UTF-16LE')] } let(:pieces) { Diff::LCS.diff old_data, new_data } let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) } it 'produces a unified diff from the two pieces' do - expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp) + expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp @@ -1,2 +1,2 @@ -Tu avec carté {count} itém has +Tu avec carte {count} item has - EOD + EXPECTED expect(hunk.diff(:unified)).to eq(expected) end it 'produces a context diff from the two pieces' do - expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp) + expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp *************** *** 1,2 **** !Tu avec carté {count} itém has --- 1,2 ---- !Tu avec carte {count} item has - EOD + EXPECTED expect(hunk.diff(:context)).to eq(expected) end it 'produces an old diff from the two pieces' do - expected = (<<-EOD.gsub(/^ +/,'').encode('UTF-16LE').chomp) + expected = <<-EXPECTED.gsub(/^ +/, '').encode('UTF-16LE').chomp 1,2c1,2 < Tu avec carté {count} itém has --- > Tu avec carte {count} item has - EOD + EXPECTED expect(hunk.diff(:old)).to eq(expected) end it 'produces a reverse ed diff from the two pieces' do - expected = (<<-EOD.gsub(/^ +/,'').encode('UTF-16LE').chomp) + expected = <<-EXPECTED.gsub(/^ +/, '').encode('UTF-16LE').chomp c1,2 Tu avec carte {count} item has . - EOD + EXPECTED expect(hunk.diff(:reverse_ed)).to eq(expected) end @@ -60,10 +60,10 @@ if String.method_defined?(:encoding) let(:old_data) { [] } it 'produces a unified diff' do - expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp) + expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp @@ -1 +1,2 @@ +Tu avec carte {count} item has - EOD + EXPECTED expect(hunk.diff(:unified)).to eq(expected) end |