diff-lcs 1.4.4 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +518 -0
  3. data/CODE_OF_CONDUCT.md +128 -0
  4. data/CONTRIBUTING.md +71 -0
  5. data/CONTRIBUTORS.md +49 -0
  6. data/{License.md → LICENCE.md} +21 -20
  7. data/Manifest.txt +76 -6
  8. data/README.md +92 -0
  9. data/Rakefile +83 -42
  10. data/SECURITY.md +41 -0
  11. data/bin/htmldiff +4 -4
  12. data/docs/artistic.txt +1 -1
  13. data/lib/diff/lcs/array.rb +1 -1
  14. data/lib/diff/lcs/backports.rb +6 -2
  15. data/lib/diff/lcs/block.rb +4 -4
  16. data/lib/diff/lcs/callbacks.rb +9 -7
  17. data/lib/diff/lcs/change.rb +22 -22
  18. data/lib/diff/lcs/htmldiff.rb +26 -16
  19. data/lib/diff/lcs/hunk.rb +66 -45
  20. data/lib/diff/lcs/internals.rb +24 -20
  21. data/lib/diff/lcs/ldiff.rb +93 -75
  22. data/lib/diff/lcs/version.rb +7 -0
  23. data/lib/diff/lcs.rb +86 -83
  24. data/lib/diff-lcs.rb +1 -1
  25. data/mise.toml +5 -0
  26. data/spec/change_spec.rb +50 -50
  27. data/spec/diff_spec.rb +14 -14
  28. data/spec/fixtures/123_x +2 -0
  29. data/spec/fixtures/456_x +2 -0
  30. data/spec/fixtures/empty +0 -0
  31. data/spec/fixtures/file1.bin +0 -0
  32. data/spec/fixtures/file2.bin +0 -0
  33. data/spec/fixtures/four_lines +4 -0
  34. data/spec/fixtures/four_lines_with_missing_new_line +4 -0
  35. data/spec/fixtures/ldiff/diff.missing_new_line1-e +1 -0
  36. data/spec/fixtures/ldiff/diff.missing_new_line1-f +1 -0
  37. data/spec/fixtures/ldiff/diff.missing_new_line2-e +1 -0
  38. data/spec/fixtures/ldiff/diff.missing_new_line2-f +1 -0
  39. data/spec/fixtures/ldiff/error.diff.chef-e +2 -0
  40. data/spec/fixtures/ldiff/error.diff.chef-f +2 -0
  41. data/spec/fixtures/ldiff/error.diff.missing_new_line1-e +1 -0
  42. data/spec/fixtures/ldiff/error.diff.missing_new_line1-f +1 -0
  43. data/spec/fixtures/ldiff/error.diff.missing_new_line2-e +1 -0
  44. data/spec/fixtures/ldiff/error.diff.missing_new_line2-f +1 -0
  45. data/spec/fixtures/ldiff/output.diff.bin1 +0 -0
  46. data/spec/fixtures/ldiff/output.diff.bin1-c +0 -0
  47. data/spec/fixtures/ldiff/output.diff.bin1-e +0 -0
  48. data/spec/fixtures/ldiff/output.diff.bin1-f +0 -0
  49. data/spec/fixtures/ldiff/output.diff.bin1-u +0 -0
  50. data/spec/fixtures/ldiff/output.diff.bin2 +1 -0
  51. data/spec/fixtures/ldiff/output.diff.bin2-c +1 -0
  52. data/spec/fixtures/ldiff/output.diff.bin2-e +1 -0
  53. data/spec/fixtures/ldiff/output.diff.bin2-f +1 -0
  54. data/spec/fixtures/ldiff/output.diff.bin2-u +1 -0
  55. data/spec/fixtures/ldiff/output.diff.chef +4 -0
  56. data/spec/fixtures/ldiff/output.diff.chef-c +15 -0
  57. data/spec/fixtures/ldiff/output.diff.chef-e +3 -0
  58. data/spec/fixtures/ldiff/output.diff.chef-f +3 -0
  59. data/spec/fixtures/ldiff/output.diff.chef-u +9 -0
  60. data/spec/fixtures/ldiff/output.diff.chef2 +7 -0
  61. data/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
  62. data/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
  63. data/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
  64. data/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
  65. data/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
  66. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines +5 -0
  67. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c +9 -0
  68. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-e +6 -0
  69. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-f +6 -0
  70. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u +7 -0
  71. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty +5 -0
  72. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c +9 -0
  73. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-e +1 -0
  74. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-f +1 -0
  75. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u +7 -0
  76. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context +4 -0
  77. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-c +9 -0
  78. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-e +3 -0
  79. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-f +3 -0
  80. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-u +6 -0
  81. data/spec/fixtures/ldiff/output.diff.missing_new_line1 +5 -0
  82. data/spec/fixtures/ldiff/output.diff.missing_new_line1-c +14 -0
  83. data/spec/fixtures/ldiff/output.diff.missing_new_line1-e +0 -0
  84. data/spec/fixtures/ldiff/output.diff.missing_new_line1-f +0 -0
  85. data/spec/fixtures/ldiff/output.diff.missing_new_line1-u +9 -0
  86. data/spec/fixtures/ldiff/output.diff.missing_new_line2 +5 -0
  87. data/spec/fixtures/ldiff/output.diff.missing_new_line2-c +14 -0
  88. data/spec/fixtures/ldiff/output.diff.missing_new_line2-e +0 -0
  89. data/spec/fixtures/ldiff/output.diff.missing_new_line2-f +0 -0
  90. data/spec/fixtures/ldiff/output.diff.missing_new_line2-u +9 -0
  91. data/spec/fixtures/new-chef +4 -0
  92. data/spec/fixtures/new-chef2 +17 -0
  93. data/spec/fixtures/old-chef +4 -0
  94. data/spec/fixtures/old-chef2 +14 -0
  95. data/spec/hunk_spec.rb +20 -20
  96. data/spec/issues_spec.rb +76 -70
  97. data/spec/lcs_spec.rb +11 -11
  98. data/spec/ldiff_spec.rb +30 -17
  99. data/spec/patch_spec.rb +84 -84
  100. data/spec/sdiff_spec.rb +111 -109
  101. data/spec/spec_helper.rb +162 -161
  102. data/spec/traverse_balanced_spec.rb +191 -189
  103. data/spec/traverse_sequences_spec.rb +31 -33
  104. metadata +112 -63
  105. data/Code-of-Conduct.md +0 -74
  106. data/Contributing.md +0 -118
  107. data/History.md +0 -319
  108. data/README.rdoc +0 -84
  109. data/autotest/discover.rb +0 -3
data/spec/diff_spec.rb CHANGED
@@ -1,28 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
- describe Diff::LCS, '.diff' do
5
+ describe Diff::LCS, ".diff" do
6
6
  include Diff::LCS::SpecHelper::Matchers
7
7
 
8
- it 'correctly diffs seq1 to seq2' do
8
+ it "correctly diffs seq1 to seq2" do
9
9
  diff_s1_s2 = Diff::LCS.diff(seq1, seq2)
10
10
  expect(change_diff(correct_forward_diff)).to eq(diff_s1_s2)
11
11
  end
12
12
 
13
- it 'correctly diffs seq2 to seq1' do
13
+ it "correctly diffs seq2 to seq1" do
14
14
  diff_s2_s1 = Diff::LCS.diff(seq2, seq1)
15
15
  expect(change_diff(correct_backward_diff)).to eq(diff_s2_s1)
16
16
  end
17
17
 
18
- it 'correctly diffs against an empty sequence' do
18
+ it "correctly diffs against an empty sequence" do
19
19
  diff = Diff::LCS.diff(word_sequence, [])
20
20
  correct_diff = [
21
21
  [
22
- ['-', 0, 'abcd'],
23
- ['-', 1, 'efgh'],
24
- ['-', 2, 'ijkl'],
25
- ['-', 3, 'mnopqrstuvwxyz']
22
+ ["-", 0, "abcd"],
23
+ ["-", 1, "efgh"],
24
+ ["-", 2, "ijkl"],
25
+ ["-", 3, "mnopqrstuvwxyz"]
26
26
  ]
27
27
  ]
28
28
 
@@ -30,22 +30,22 @@ describe Diff::LCS, '.diff' do
30
30
 
31
31
  diff = Diff::LCS.diff([], word_sequence)
32
32
  correct_diff.each do |hunk|
33
- hunk.each do |change| change[0] = '+' end
33
+ hunk.each { |change| change[0] = "+" }
34
34
  end
35
35
  expect(change_diff(correct_diff)).to eq(diff)
36
36
  end
37
37
 
38
38
  it "correctly diffs 'xx' and 'xaxb'" do
39
- left = 'xx'
40
- right = 'xaxb'
39
+ left = "xx"
40
+ right = "xaxb"
41
41
  expect(Diff::LCS.patch(left, Diff::LCS.diff(left, right))).to eq(right)
42
42
  end
43
43
 
44
- it 'returns an empty diff with (hello, hello)' do
44
+ it "returns an empty diff with (hello, hello)" do
45
45
  expect(Diff::LCS.diff(hello, hello)).to be_empty
46
46
  end
47
47
 
48
- it 'returns an empty diff with (hello_ary, hello_ary)' do
48
+ it "returns an empty diff with (hello_ary, hello_ary)" do
49
49
  expect(Diff::LCS.diff(hello_ary, hello_ary)).to be_empty
50
50
  end
51
51
  end
@@ -0,0 +1,2 @@
1
+ 123
2
+ x
@@ -0,0 +1,2 @@
1
+ 456
2
+ x
File without changes
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ one
2
+ two
3
+ three
4
+ four
@@ -0,0 +1,4 @@
1
+ one
2
+ two
3
+ three
4
+ four
@@ -0,0 +1 @@
1
+ No newline at end of file
@@ -0,0 +1 @@
1
+ No newline at end of file
@@ -0,0 +1 @@
1
+ No newline at end of file
@@ -0,0 +1 @@
1
+ No newline at end of file
@@ -0,0 +1,2 @@
1
+ <old_file>: No newline at end of file
2
+ <new_file>: No newline at end of file
@@ -0,0 +1,2 @@
1
+ <old_file>: No newline at end of file
2
+ <new_file>: No newline at end of file
@@ -0,0 +1 @@
1
+ <new_file>: No newline at end of file
@@ -0,0 +1 @@
1
+ <new_file>: No newline at end of file
@@ -0,0 +1 @@
1
+ <old_file>: No newline at end of file
@@ -0,0 +1 @@
1
+ <old_file>: No newline at end of file
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ Binary files spec/fixtures/file1.bin and spec/fixtures/file2.bin differ
@@ -0,0 +1 @@
1
+ Binary files spec/fixtures/file1.bin and spec/fixtures/file2.bin differ
@@ -0,0 +1 @@
1
+ Binary files spec/fixtures/file1.bin and spec/fixtures/file2.bin differ
@@ -0,0 +1 @@
1
+ Binary files spec/fixtures/file1.bin and spec/fixtures/file2.bin differ
@@ -0,0 +1 @@
1
+ Binary files spec/fixtures/file1.bin and spec/fixtures/file2.bin differ
@@ -0,0 +1,4 @@
1
+ 3c3
2
+ < "description": "hi"
3
+ ---
4
+ > "description": "lo"
@@ -0,0 +1,15 @@
1
+ *** spec/fixtures/old-chef 2020-06-23 23:18:20.000000000 -0400
2
+ --- spec/fixtures/new-chef 2020-06-23 23:18:20.000000000 -0400
3
+ ***************
4
+ *** 1,4 ****
5
+ {
6
+ "name": "x",
7
+ ! "description": "hi"
8
+ }
9
+
10
+ --- 1,4 ----
11
+ {
12
+ "name": "x",
13
+ ! "description": "lo"
14
+ }
15
+
@@ -0,0 +1,3 @@
1
+ 3c
2
+ "description": "lo"
3
+ .
@@ -0,0 +1,3 @@
1
+ c3
2
+ "description": "lo"
3
+ .
@@ -0,0 +1,9 @@
1
+ --- spec/fixtures/old-chef 2020-06-23 23:18:20.000000000 -0400
2
+ +++ spec/fixtures/new-chef 2020-06-23 23:18:20.000000000 -0400
3
+ @@ -1,4 +1,4 @@
4
+ {
5
+ "name": "x",
6
+ - "description": "hi"
7
+ + "description": "lo"
8
+ }
9
+
@@ -0,0 +1,7 @@
1
+ 2d1
2
+ < recipe[b::default]
3
+ 14a14,17
4
+ > recipe[o::new]
5
+ > recipe[p::new]
6
+ > recipe[q::new]
7
+ > recipe[r::new]
@@ -0,0 +1,20 @@
1
+ *** spec/fixtures/old-chef2 2020-06-30 09:43:35.000000000 -0400
2
+ --- spec/fixtures/new-chef2 2020-06-30 09:44:32.000000000 -0400
3
+ ***************
4
+ *** 1,5 ****
5
+ recipe[a::default]
6
+ - recipe[b::default]
7
+ recipe[c::default]
8
+ recipe[d::default]
9
+ recipe[e::default]
10
+ --- 1,4 ----
11
+ ***************
12
+ *** 12,14 ****
13
+ --- 11,17 ----
14
+ recipe[l::default]
15
+ recipe[m::default]
16
+ recipe[n::default]
17
+ + recipe[o::new]
18
+ + recipe[p::new]
19
+ + recipe[q::new]
20
+ + recipe[r::new]
@@ -0,0 +1,7 @@
1
+ d2
2
+ a14
3
+ recipe[o::new]
4
+ recipe[p::new]
5
+ recipe[q::new]
6
+ recipe[r::new]
7
+ .
@@ -0,0 +1,7 @@
1
+ 14a
2
+ recipe[o::new]
3
+ recipe[p::new]
4
+ recipe[q::new]
5
+ recipe[r::new]
6
+ .
7
+ 2d
@@ -0,0 +1,7 @@
1
+ d2
2
+ a14
3
+ recipe[o::new]
4
+ recipe[p::new]
5
+ recipe[q::new]
6
+ recipe[r::new]
7
+ .
@@ -0,0 +1,16 @@
1
+ --- spec/fixtures/old-chef2 2020-06-30 09:43:35.000000000 -0400
2
+ +++ spec/fixtures/new-chef2 2020-06-30 09:44:32.000000000 -0400
3
+ @@ -1,5 +1,4 @@
4
+ recipe[a::default]
5
+ -recipe[b::default]
6
+ recipe[c::default]
7
+ recipe[d::default]
8
+ recipe[e::default]
9
+ @@ -12,3 +11,7 @@
10
+ recipe[l::default]
11
+ recipe[m::default]
12
+ recipe[n::default]
13
+ +recipe[o::new]
14
+ +recipe[p::new]
15
+ +recipe[q::new]
16
+ +recipe[r::new]
@@ -0,0 +1,5 @@
1
+ 0a1,4
2
+ > one
3
+ > two
4
+ > three
5
+ > four
@@ -0,0 +1,9 @@
1
+ *** spec/fixtures/empty 2025-01-31 12:14:52.856031635 +0100
2
+ --- spec/fixtures/four_lines 2025-01-31 12:13:45.476036544 +0100
3
+ ***************
4
+ *** 0 ****
5
+ --- 1,4 ----
6
+ + one
7
+ + two
8
+ + three
9
+ + four
@@ -0,0 +1,6 @@
1
+ 0a
2
+ one
3
+ two
4
+ three
5
+ four
6
+ .
@@ -0,0 +1,6 @@
1
+ a0
2
+ one
3
+ two
4
+ three
5
+ four
6
+ .
@@ -0,0 +1,7 @@
1
+ --- spec/fixtures/empty 2025-01-31 12:14:52.856031635 +0100
2
+ +++ spec/fixtures/four_lines 2025-01-31 12:13:45.476036544 +0100
3
+ @@ -0,0 +1,4 @@
4
+ +one
5
+ +two
6
+ +three
7
+ +four
@@ -0,0 +1,5 @@
1
+ 1,4d0
2
+ < one
3
+ < two
4
+ < three
5
+ < four
@@ -0,0 +1,9 @@
1
+ *** spec/fixtures/four_lines 2025-01-31 12:13:45.476036544 +0100
2
+ --- spec/fixtures/empty 2025-01-31 12:14:52.856031635 +0100
3
+ ***************
4
+ *** 1,4 ****
5
+ - one
6
+ - two
7
+ - three
8
+ - four
9
+ --- 0 ----
@@ -0,0 +1,7 @@
1
+ --- spec/fixtures/four_lines 2025-01-31 12:13:45.476036544 +0100
2
+ +++ spec/fixtures/empty 2025-01-31 12:14:52.856031635 +0100
3
+ @@ -1,4 +0,0 @@
4
+ -one
5
+ -two
6
+ -three
7
+ -four
@@ -0,0 +1,4 @@
1
+ 1c1
2
+ < 123
3
+ ---
4
+ > 456
@@ -0,0 +1,9 @@
1
+ *** spec/fixtures/123_x 2025-01-31 17:00:17.070615716 +0100
2
+ --- spec/fixtures/456_x 2025-01-31 16:58:26.380624827 +0100
3
+ ***************
4
+ *** 1,2 ****
5
+ ! 123
6
+ x
7
+ --- 1,2 ----
8
+ ! 456
9
+ x
@@ -0,0 +1,6 @@
1
+ --- spec/fixtures/123_x 2025-01-31 17:00:17.070615716 +0100
2
+ +++ spec/fixtures/456_x 2025-01-31 16:58:26.380624827 +0100
3
+ @@ -1,2 +1,2 @@
4
+ -123
5
+ +456
6
+ x
@@ -0,0 +1,5 @@
1
+ 4c4
2
+ < four
3
+ ---
4
+ > four
5
+
@@ -0,0 +1,14 @@
1
+ *** spec/fixtures/four_lines 2025-01-31 12:17:43.926013315 +0100
2
+ --- spec/fixtures/four_lines_with_missing_new_line 2025-01-31 12:17:43.926013315 +0100
3
+ ***************
4
+ *** 1,4 ****
5
+ one
6
+ two
7
+ three
8
+ ! four
9
+ --- 1,4 ----
10
+ one
11
+ two
12
+ three
13
+ ! four
14
+
@@ -0,0 +1,9 @@
1
+ --- spec/fixtures/four_lines 2025-01-31 12:17:43.926013315 +0100
2
+ +++ spec/fixtures/four_lines_with_missing_new_line 2025-01-31 12:17:43.926013315 +0100
3
+ @@ -1,4 +1,4 @@
4
+ one
5
+ two
6
+ three
7
+ -four
8
+ +four
9
+
@@ -0,0 +1,5 @@
1
+ 4c4
2
+ < four
3
+
4
+ ---
5
+ > four
@@ -0,0 +1,14 @@
1
+ *** spec/fixtures/four_lines_with_missing_new_line 2025-01-31 12:17:43.926013315 +0100
2
+ --- spec/fixtures/four_lines 2025-01-31 12:17:43.926013315 +0100
3
+ ***************
4
+ *** 1,4 ****
5
+ one
6
+ two
7
+ three
8
+ ! four
9
+
10
+ --- 1,4 ----
11
+ one
12
+ two
13
+ three
14
+ ! four
@@ -0,0 +1,9 @@
1
+ --- spec/fixtures/four_lines_with_missing_new_line 2025-01-31 12:17:43.926013315 +0100
2
+ +++ spec/fixtures/four_lines 2025-01-31 12:17:43.926013315 +0100
3
+ @@ -1,4 +1,4 @@
4
+ one
5
+ two
6
+ three
7
+ -four
8
+
9
+ +four
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "x",
3
+ "description": "lo"
4
+ }
@@ -0,0 +1,17 @@
1
+ recipe[a::default]
2
+ recipe[c::default]
3
+ recipe[d::default]
4
+ recipe[e::default]
5
+ recipe[f::default]
6
+ recipe[g::default]
7
+ recipe[h::default]
8
+ recipe[i::default]
9
+ recipe[j::default]
10
+ recipe[k::default]
11
+ recipe[l::default]
12
+ recipe[m::default]
13
+ recipe[n::default]
14
+ recipe[o::new]
15
+ recipe[p::new]
16
+ recipe[q::new]
17
+ recipe[r::new]
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "x",
3
+ "description": "hi"
4
+ }
@@ -0,0 +1,14 @@
1
+ recipe[a::default]
2
+ recipe[b::default]
3
+ recipe[c::default]
4
+ recipe[d::default]
5
+ recipe[e::default]
6
+ recipe[f::default]
7
+ recipe[g::default]
8
+ recipe[h::default]
9
+ recipe[i::default]
10
+ recipe[j::default]
11
+ recipe[k::default]
12
+ recipe[l::default]
13
+ recipe[m::default]
14
+ recipe[n::default]
data/spec/hunk_spec.rb CHANGED
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  if String.method_defined?(:encoding)
6
- require 'diff/lcs/hunk'
6
+ require "diff/lcs/hunk"
7
7
 
8
8
  describe Diff::LCS::Hunk do
9
- let(:old_data) { ['Tu a un carté avec {count} itéms'.encode('UTF-16LE')] }
10
- let(:new_data) { ['Tu a un carte avec {count} items'.encode('UTF-16LE')] }
11
- let(:pieces) { Diff::LCS.diff old_data, new_data }
12
- let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
9
+ let(:old_data) { ["Tu a un carté avec {count} itéms".encode("UTF-16LE")] }
10
+ let(:new_data) { ["Tu a un carte avec {count} items".encode("UTF-16LE")] }
11
+ let(:pieces) { Diff::LCS.diff old_data, new_data }
12
+ let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
13
13
 
14
- it 'produces a unified diff from the two pieces' do
15
- expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
14
+ it "produces a unified diff from the two pieces" do
15
+ expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
16
16
  @@ -1 +1 @@
17
17
  -Tu a un carté avec {count} itéms
18
18
  +Tu a un carte avec {count} items
@@ -21,8 +21,8 @@ if String.method_defined?(:encoding)
21
21
  expect(hunk.diff(:unified)).to eq(expected)
22
22
  end
23
23
 
24
- it 'produces a unified diff from the two pieces (last entry)' do
25
- expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
24
+ it "produces a unified diff from the two pieces (last entry)" do
25
+ expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
26
26
  @@ -1 +1 @@
27
27
  -Tu a un carté avec {count} itéms
28
28
  +Tu a un carte avec {count} items
@@ -32,8 +32,8 @@ if String.method_defined?(:encoding)
32
32
  expect(hunk.diff(:unified, true)).to eq(expected)
33
33
  end
34
34
 
35
- it 'produces a context diff from the two pieces' do
36
- expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
35
+ it "produces a context diff from the two pieces" do
36
+ expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
37
37
  ***************
38
38
  *** 1 ****
39
39
  ! Tu a un carté avec {count} itéms
@@ -44,8 +44,8 @@ if String.method_defined?(:encoding)
44
44
  expect(hunk.diff(:context)).to eq(expected)
45
45
  end
46
46
 
47
- it 'produces an old diff from the two pieces' do
48
- expected = <<-EXPECTED.gsub(/^ +/, '').encode('UTF-16LE').chomp
47
+ it "produces an old diff from the two pieces" do
48
+ expected = <<-EXPECTED.gsub(/^ +/, "").encode("UTF-16LE").chomp
49
49
  1c1
50
50
  < Tu a un carté avec {count} itéms
51
51
  ---
@@ -56,8 +56,8 @@ if String.method_defined?(:encoding)
56
56
  expect(hunk.diff(:old)).to eq(expected)
57
57
  end
58
58
 
59
- it 'produces a reverse ed diff from the two pieces' do
60
- expected = <<-EXPECTED.gsub(/^ +/, '').encode('UTF-16LE').chomp
59
+ it "produces a reverse ed diff from the two pieces" do
60
+ expected = <<-EXPECTED.gsub(/^ +/, "").encode("UTF-16LE").chomp
61
61
  c1
62
62
  Tu a un carte avec {count} items
63
63
  .
@@ -67,12 +67,12 @@ if String.method_defined?(:encoding)
67
67
  expect(hunk.diff(:reverse_ed)).to eq(expected)
68
68
  end
69
69
 
70
- context 'with empty first data set' do
70
+ context "with empty first data set" do
71
71
  let(:old_data) { [] }
72
72
 
73
- it 'produces a unified diff' do
74
- expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
75
- @@ -1 +1,2 @@
73
+ it "produces a unified diff" do
74
+ expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
75
+ @@ -0,0 +1 @@
76
76
  +Tu a un carte avec {count} items
77
77
  EXPECTED
78
78