diff-lcs 1.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/Contributing.md +84 -48
  3. data/History.md +334 -154
  4. data/Manifest.txt +23 -1
  5. data/README.rdoc +10 -10
  6. data/Rakefile +85 -21
  7. data/bin/htmldiff +7 -4
  8. data/bin/ldiff +4 -1
  9. data/lib/diff/lcs/array.rb +1 -1
  10. data/lib/diff/lcs/backports.rb +9 -0
  11. data/lib/diff/lcs/block.rb +1 -1
  12. data/lib/diff/lcs/callbacks.rb +15 -12
  13. data/lib/diff/lcs/change.rb +30 -37
  14. data/lib/diff/lcs/htmldiff.rb +17 -16
  15. data/lib/diff/lcs/hunk.rb +156 -74
  16. data/lib/diff/lcs/internals.rb +43 -42
  17. data/lib/diff/lcs/ldiff.rb +46 -42
  18. data/lib/diff/lcs/string.rb +1 -1
  19. data/lib/diff/lcs.rb +188 -174
  20. data/lib/diff-lcs.rb +1 -1
  21. data/spec/change_spec.rb +31 -7
  22. data/spec/diff_spec.rb +16 -12
  23. data/spec/fixtures/aX +1 -0
  24. data/spec/fixtures/bXaX +1 -0
  25. data/spec/fixtures/ldiff/output.diff +4 -0
  26. data/spec/fixtures/ldiff/output.diff-c +7 -0
  27. data/spec/fixtures/ldiff/output.diff-e +3 -0
  28. data/spec/fixtures/ldiff/output.diff-f +3 -0
  29. data/spec/fixtures/ldiff/output.diff-u +5 -0
  30. data/spec/fixtures/ldiff/output.diff.chef +4 -0
  31. data/spec/fixtures/ldiff/output.diff.chef-c +15 -0
  32. data/spec/fixtures/ldiff/output.diff.chef-e +3 -0
  33. data/spec/fixtures/ldiff/output.diff.chef-f +3 -0
  34. data/spec/fixtures/ldiff/output.diff.chef-u +9 -0
  35. data/spec/fixtures/ldiff/output.diff.chef2 +7 -0
  36. data/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
  37. data/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
  38. data/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
  39. data/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
  40. data/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
  41. data/spec/fixtures/new-chef +4 -0
  42. data/spec/fixtures/new-chef2 +17 -0
  43. data/spec/fixtures/old-chef +4 -0
  44. data/spec/fixtures/old-chef2 +14 -0
  45. data/spec/hunk_spec.rb +37 -26
  46. data/spec/issues_spec.rb +115 -10
  47. data/spec/lcs_spec.rb +10 -10
  48. data/spec/ldiff_spec.rb +71 -31
  49. data/spec/patch_spec.rb +93 -99
  50. data/spec/sdiff_spec.rb +89 -89
  51. data/spec/spec_helper.rb +118 -65
  52. data/spec/traverse_balanced_spec.rb +173 -173
  53. data/spec/traverse_sequences_spec.rb +29 -31
  54. metadata +54 -33
  55. data/autotest/discover.rb +0 -1
@@ -1,310 +1,310 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe "Diff::LCS.traverse_balanced" do
5
+ describe 'Diff::LCS.traverse_balanced' do
6
6
  include Diff::LCS::SpecHelper::Matchers
7
7
 
8
- shared_examples "with a #change callback" do |s1, s2, result|
9
- it "traverses s1 -> s2 correctly" do
8
+ shared_examples 'with a #change callback' do |s1, s2, result|
9
+ it 'traverses s1 -> s2 correctly' do
10
10
  traversal = balanced_traversal(s1, s2, :balanced_callback)
11
11
  expect(traversal.result).to eq(result)
12
12
  end
13
13
 
14
- it "traverses s2 -> s1 correctly" do
14
+ it 'traverses s2 -> s1 correctly' do
15
15
  traversal = balanced_traversal(s2, s1, :balanced_callback)
16
16
  expect(traversal.result).to eq(balanced_reverse(result))
17
17
  end
18
18
  end
19
19
 
20
- shared_examples "without a #change callback" do |s1, s2, result|
21
- it "traverses s1 -> s2 correctly" do
20
+ shared_examples 'without a #change callback' do |s1, s2, result|
21
+ it 'traverses s1 -> s2 correctly' do
22
22
  traversal = balanced_traversal(s1, s2, :balanced_callback_no_change)
23
23
  expect(traversal.result).to eq(map_to_no_change(result))
24
24
  end
25
25
 
26
- it "traverses s2 -> s1 correctly" do
26
+ it 'traverses s2 -> s1 correctly' do
27
27
  traversal = balanced_traversal(s2, s1, :balanced_callback_no_change)
28
28
  expect(traversal.result).to eq(map_to_no_change(balanced_reverse(result)))
29
29
  end
30
30
  end
31
31
 
32
32
  describe "identical string sequences ('abc')" do
33
- s1 = s2 = "abc"
33
+ s1 = s2 = 'abc'
34
34
 
35
35
  result = [
36
- [ '=', 0, 0 ],
37
- [ '=', 1, 1 ],
38
- [ '=', 2, 2 ]
36
+ ['=', 0, 0],
37
+ ['=', 1, 1],
38
+ ['=', 2, 2]
39
39
  ]
40
40
 
41
- it_has_behavior "with a #change callback", s1, s2, result
42
- it_has_behavior "without a #change callback", s1, s2, result
41
+ it_has_behavior 'with a #change callback', s1, s2, result
42
+ it_has_behavior 'without a #change callback', s1, s2, result
43
43
  end
44
44
 
45
- describe "identical array sequences %w(a b c)" do
45
+ describe 'identical array sequences %w(a b c)' do
46
46
  s1 = s2 = %w(a b c)
47
47
 
48
48
  result = [
49
- [ '=', 0, 0 ],
50
- [ '=', 1, 1 ],
51
- [ '=', 2, 2 ]
49
+ ['=', 0, 0],
50
+ ['=', 1, 1],
51
+ ['=', 2, 2]
52
52
  ]
53
53
 
54
- it_has_behavior "with a #change callback", s1, s2, result
55
- it_has_behavior "without a #change callback", s1, s2, result
54
+ it_has_behavior 'with a #change callback', s1, s2, result
55
+ it_has_behavior 'without a #change callback', s1, s2, result
56
56
  end
57
57
 
58
- describe "sequences %w(a b c) & %w(a x c)" do
58
+ describe 'sequences %w(a b c) & %w(a x c)' do
59
59
  s1 = %w(a b c)
60
60
  s2 = %w(a x c)
61
61
 
62
62
  result = [
63
- [ '=', 0, 0 ],
64
- [ '!', 1, 1 ],
65
- [ '=', 2, 2 ]
63
+ ['=', 0, 0],
64
+ ['!', 1, 1],
65
+ ['=', 2, 2]
66
66
  ]
67
67
 
68
- it_has_behavior "with a #change callback", s1, s2, result
69
- it_has_behavior "without a #change callback", s1, s2, result
68
+ it_has_behavior 'with a #change callback', s1, s2, result
69
+ it_has_behavior 'without a #change callback', s1, s2, result
70
70
  end
71
71
 
72
- describe "sequences %w(a x y c) & %w(a v w c)" do
72
+ describe 'sequences %w(a x y c) & %w(a v w c)' do
73
73
  s1 = %w(a x y c)
74
74
  s2 = %w(a v w c)
75
75
 
76
76
  result = [
77
- [ '=', 0, 0 ],
78
- [ '!', 1, 1 ],
79
- [ '!', 2, 2 ],
80
- [ '=', 3, 3 ]
77
+ ['=', 0, 0],
78
+ ['!', 1, 1],
79
+ ['!', 2, 2],
80
+ ['=', 3, 3]
81
81
  ]
82
82
 
83
- it_has_behavior "with a #change callback", s1, s2, result
84
- it_has_behavior "without a #change callback", s1, s2, result
83
+ it_has_behavior 'with a #change callback', s1, s2, result
84
+ it_has_behavior 'without a #change callback', s1, s2, result
85
85
  end
86
86
 
87
- describe "sequences %w(x y c) & %w(v w c)" do
87
+ describe 'sequences %w(x y c) & %w(v w c)' do
88
88
  s1 = %w(x y c)
89
89
  s2 = %w(v w c)
90
90
  result = [
91
- [ '!', 0, 0 ],
92
- [ '!', 1, 1 ],
93
- [ '=', 2, 2 ]
91
+ ['!', 0, 0],
92
+ ['!', 1, 1],
93
+ ['=', 2, 2]
94
94
  ]
95
95
 
96
- it_has_behavior "with a #change callback", s1, s2, result
97
- it_has_behavior "without a #change callback", s1, s2, result
96
+ it_has_behavior 'with a #change callback', s1, s2, result
97
+ it_has_behavior 'without a #change callback', s1, s2, result
98
98
  end
99
99
 
100
- describe "sequences %w(a x y z) & %w(b v w)" do
100
+ describe 'sequences %w(a x y z) & %w(b v w)' do
101
101
  s1 = %w(a x y z)
102
102
  s2 = %w(b v w)
103
103
  result = [
104
- [ '!', 0, 0 ],
105
- [ '!', 1, 1 ],
106
- [ '!', 2, 2 ],
107
- [ '<', 3, 3 ]
104
+ ['!', 0, 0],
105
+ ['!', 1, 1],
106
+ ['!', 2, 2],
107
+ ['<', 3, 3]
108
108
  ]
109
109
 
110
- it_has_behavior "with a #change callback", s1, s2, result
111
- it_has_behavior "without a #change callback", s1, s2, result
110
+ it_has_behavior 'with a #change callback', s1, s2, result
111
+ it_has_behavior 'without a #change callback', s1, s2, result
112
112
  end
113
113
 
114
- describe "sequences %w(a z) & %w(a)" do
114
+ describe 'sequences %w(a z) & %w(a)' do
115
115
  s1 = %w(a z)
116
116
  s2 = %w(a)
117
117
  result = [
118
- [ '=', 0, 0 ],
119
- [ '<', 1, 1 ]
118
+ ['=', 0, 0],
119
+ ['<', 1, 1]
120
120
  ]
121
121
 
122
- it_has_behavior "with a #change callback", s1, s2, result
123
- it_has_behavior "without a #change callback", s1, s2, result
122
+ it_has_behavior 'with a #change callback', s1, s2, result
123
+ it_has_behavior 'without a #change callback', s1, s2, result
124
124
  end
125
125
 
126
- describe "sequences %w(z a) & %w(a)" do
126
+ describe 'sequences %w(z a) & %w(a)' do
127
127
  s1 = %w(z a)
128
128
  s2 = %w(a)
129
129
  result = [
130
- [ '<', 0, 0 ],
131
- [ '=', 1, 0 ]
130
+ ['<', 0, 0],
131
+ ['=', 1, 0]
132
132
  ]
133
133
 
134
- it_has_behavior "with a #change callback", s1, s2, result
135
- it_has_behavior "without a #change callback", s1, s2, result
134
+ it_has_behavior 'with a #change callback', s1, s2, result
135
+ it_has_behavior 'without a #change callback', s1, s2, result
136
136
  end
137
137
 
138
- describe "sequences %w(a b c) & %w(x y z)" do
138
+ describe 'sequences %w(a b c) & %w(x y z)' do
139
139
  s1 = %w(a b c)
140
140
  s2 = %w(x y z)
141
141
  result = [
142
- [ '!', 0, 0 ],
143
- [ '!', 1, 1 ],
144
- [ '!', 2, 2 ]
142
+ ['!', 0, 0],
143
+ ['!', 1, 1],
144
+ ['!', 2, 2]
145
145
  ]
146
146
 
147
- it_has_behavior "with a #change callback", s1, s2, result
148
- it_has_behavior "without a #change callback", s1, s2, result
147
+ it_has_behavior 'with a #change callback', s1, s2, result
148
+ it_has_behavior 'without a #change callback', s1, s2, result
149
149
  end
150
150
 
151
- describe "sequences %w(abcd efgh ijkl mnoopqrstuvwxyz) & []" do
151
+ describe 'sequences %w(abcd efgh ijkl mnoopqrstuvwxyz) & []' do
152
152
  s1 = %w(abcd efgh ijkl mnopqrstuvwxyz)
153
153
  s2 = []
154
154
  result = [
155
- [ '<', 0, 0 ],
156
- [ '<', 1, 0 ],
157
- [ '<', 2, 0 ],
158
- [ '<', 3, 0 ]
155
+ ['<', 0, 0],
156
+ ['<', 1, 0],
157
+ ['<', 2, 0],
158
+ ['<', 3, 0]
159
159
  ]
160
160
 
161
- it_has_behavior "with a #change callback", s1, s2, result
162
- it_has_behavior "without a #change callback", s1, s2, result
161
+ it_has_behavior 'with a #change callback', s1, s2, result
162
+ it_has_behavior 'without a #change callback', s1, s2, result
163
163
  end
164
164
 
165
- describe "strings %Q(a b c) & %Q(a x c)" do
166
- s1 = %Q(a b c)
167
- s2 = %Q(a x c)
165
+ describe 'strings %q(a b c) & %q(a x c)' do
166
+ s1 = 'a b c'
167
+ s2 = 'a x c'
168
168
 
169
169
  result = [
170
- [ '=', 0, 0 ],
171
- [ '=', 1, 1 ],
172
- [ '!', 2, 2 ],
173
- [ '=', 3, 3 ],
174
- [ '=', 4, 4 ]
170
+ ['=', 0, 0],
171
+ ['=', 1, 1],
172
+ ['!', 2, 2],
173
+ ['=', 3, 3],
174
+ ['=', 4, 4]
175
175
  ]
176
176
 
177
- it_has_behavior "with a #change callback", s1, s2, result
178
- it_has_behavior "without a #change callback", s1, s2, result
177
+ it_has_behavior 'with a #change callback', s1, s2, result
178
+ it_has_behavior 'without a #change callback', s1, s2, result
179
179
  end
180
180
 
181
- describe "strings %Q(a x y c) & %Q(a v w c)" do
182
- s1 = %Q(a x y c)
183
- s2 = %Q(a v w c)
181
+ describe 'strings %q(a x y c) & %q(a v w c)' do
182
+ s1 = 'a x y c'
183
+ s2 = 'a v w c'
184
184
 
185
185
  result = [
186
- [ '=', 0, 0 ],
187
- [ '=', 1, 1 ],
188
- [ '!', 2, 2 ],
189
- [ '=', 3, 3 ],
190
- [ '!', 4, 4 ],
191
- [ '=', 5, 5 ],
192
- [ '=', 6, 6 ]
186
+ ['=', 0, 0],
187
+ ['=', 1, 1],
188
+ ['!', 2, 2],
189
+ ['=', 3, 3],
190
+ ['!', 4, 4],
191
+ ['=', 5, 5],
192
+ ['=', 6, 6]
193
193
  ]
194
194
 
195
- it_has_behavior "with a #change callback", s1, s2, result
196
- it_has_behavior "without a #change callback", s1, s2, result
195
+ it_has_behavior 'with a #change callback', s1, s2, result
196
+ it_has_behavior 'without a #change callback', s1, s2, result
197
197
  end
198
198
 
199
- describe "strings %Q(x y c) & %Q(v w c)" do
200
- s1 = %Q(x y c)
201
- s2 = %Q(v w c)
199
+ describe 'strings %q(x y c) & %q(v w c)' do
200
+ s1 = 'x y c'
201
+ s2 = 'v w c'
202
202
  result = [
203
- [ '!', 0, 0 ],
204
- [ '=', 1, 1 ],
205
- [ '!', 2, 2 ],
206
- [ '=', 3, 3 ],
207
- [ '=', 4, 4 ]
203
+ ['!', 0, 0],
204
+ ['=', 1, 1],
205
+ ['!', 2, 2],
206
+ ['=', 3, 3],
207
+ ['=', 4, 4]
208
208
  ]
209
209
 
210
- it_has_behavior "with a #change callback", s1, s2, result
211
- it_has_behavior "without a #change callback", s1, s2, result
210
+ it_has_behavior 'with a #change callback', s1, s2, result
211
+ it_has_behavior 'without a #change callback', s1, s2, result
212
212
  end
213
213
 
214
- describe "strings %Q(a x y z) & %Q(b v w)" do
215
- s1 = %Q(a x y z)
216
- s2 = %Q(b v w)
214
+ describe 'strings %q(a x y z) & %q(b v w)' do
215
+ s1 = 'a x y z'
216
+ s2 = 'b v w'
217
217
  result = [
218
- [ '!', 0, 0 ],
219
- [ '=', 1, 1 ],
220
- [ '!', 2, 2 ],
221
- [ '=', 3, 3 ],
222
- [ '!', 4, 4 ],
223
- [ '<', 5, 5 ],
224
- [ '<', 6, 5 ]
218
+ ['!', 0, 0],
219
+ ['=', 1, 1],
220
+ ['!', 2, 2],
221
+ ['=', 3, 3],
222
+ ['!', 4, 4],
223
+ ['<', 5, 5],
224
+ ['<', 6, 5]
225
225
  ]
226
226
 
227
- it_has_behavior "with a #change callback", s1, s2, result
228
- it_has_behavior "without a #change callback", s1, s2, result
227
+ it_has_behavior 'with a #change callback', s1, s2, result
228
+ it_has_behavior 'without a #change callback', s1, s2, result
229
229
  end
230
230
 
231
- describe "strings %Q(a z) & %Q(a)" do
232
- s1 = %Q(a z)
233
- s2 = %Q(a)
231
+ describe 'strings %q(a z) & %q(a)' do
232
+ s1 = 'a z'
233
+ s2 = 'a'
234
234
  result = [
235
- [ '=', 0, 0 ],
236
- [ '<', 1, 1 ],
237
- [ '<', 2, 1 ]
235
+ ['=', 0, 0],
236
+ ['<', 1, 1],
237
+ ['<', 2, 1]
238
238
  ]
239
239
 
240
- it_has_behavior "with a #change callback", s1, s2, result
241
- it_has_behavior "without a #change callback", s1, s2, result
240
+ it_has_behavior 'with a #change callback', s1, s2, result
241
+ it_has_behavior 'without a #change callback', s1, s2, result
242
242
  end
243
243
 
244
- describe "strings %Q(z a) & %Q(a)" do
245
- s1 = %Q(z a)
246
- s2 = %Q(a)
244
+ describe 'strings %q(z a) & %q(a)' do
245
+ s1 = 'z a'
246
+ s2 = 'a'
247
247
  result = [
248
- [ '<', 0, 0 ],
249
- [ '<', 1, 0 ],
250
- [ '=', 2, 0 ]
248
+ ['<', 0, 0],
249
+ ['<', 1, 0],
250
+ ['=', 2, 0]
251
251
  ]
252
252
 
253
- it_has_behavior "with a #change callback", s1, s2, result
254
- it_has_behavior "without a #change callback", s1, s2, result
253
+ it_has_behavior 'with a #change callback', s1, s2, result
254
+ it_has_behavior 'without a #change callback', s1, s2, result
255
255
  end
256
256
 
257
- describe "strings %Q(a b c) & %Q(x y z)" do
258
- s1 = %Q(a b c)
259
- s2 = %Q(x y z)
257
+ describe 'strings %q(a b c) & %q(x y z)' do
258
+ s1 = 'a b c'
259
+ s2 = 'x y z'
260
260
  result = [
261
- [ '!', 0, 0 ],
262
- [ '=', 1, 1 ],
263
- [ '!', 2, 2 ],
264
- [ '=', 3, 3 ],
265
- [ '!', 4, 4 ]
261
+ ['!', 0, 0],
262
+ ['=', 1, 1],
263
+ ['!', 2, 2],
264
+ ['=', 3, 3],
265
+ ['!', 4, 4]
266
266
  ]
267
267
 
268
- it_has_behavior "with a #change callback", s1, s2, result
269
- it_has_behavior "without a #change callback", s1, s2, result
268
+ it_has_behavior 'with a #change callback', s1, s2, result
269
+ it_has_behavior 'without a #change callback', s1, s2, result
270
270
  end
271
271
 
272
- describe "strings %Q(abcd efgh ijkl mnopqrstuvwxyz) & %Q()" do
273
- s1 = %Q(abcd efgh ijkl mnopqrstuvwxyz)
274
- s2 = ""
272
+ describe 'strings %q(abcd efgh ijkl mnopqrstuvwxyz) & %q()' do
273
+ s1 = 'abcd efgh ijkl mnopqrstuvwxyz'
274
+ s2 = ''
275
275
  result = [
276
- [ '<', 0, 0 ],
277
- [ '<', 1, 0 ],
278
- [ '<', 2, 0 ],
279
- [ '<', 3, 0 ],
280
- [ '<', 4, 0 ],
281
- [ '<', 5, 0 ],
282
- [ '<', 6, 0 ],
283
- [ '<', 7, 0 ],
284
- [ '<', 8, 0 ],
285
- [ '<', 9, 0 ],
286
- [ '<', 10, 0 ],
287
- [ '<', 11, 0 ],
288
- [ '<', 12, 0 ],
289
- [ '<', 13, 0 ],
290
- [ '<', 14, 0 ],
291
- [ '<', 15, 0 ],
292
- [ '<', 16, 0 ],
293
- [ '<', 17, 0 ],
294
- [ '<', 18, 0 ],
295
- [ '<', 19, 0 ],
296
- [ '<', 20, 0 ],
297
- [ '<', 21, 0 ],
298
- [ '<', 22, 0 ],
299
- [ '<', 23, 0 ],
300
- [ '<', 24, 0 ],
301
- [ '<', 25, 0 ],
302
- [ '<', 26, 0 ],
303
- [ '<', 27, 0 ],
304
- [ '<', 28, 0 ],
276
+ ['<', 0, 0],
277
+ ['<', 1, 0],
278
+ ['<', 2, 0],
279
+ ['<', 3, 0],
280
+ ['<', 4, 0],
281
+ ['<', 5, 0],
282
+ ['<', 6, 0],
283
+ ['<', 7, 0],
284
+ ['<', 8, 0],
285
+ ['<', 9, 0],
286
+ ['<', 10, 0],
287
+ ['<', 11, 0],
288
+ ['<', 12, 0],
289
+ ['<', 13, 0],
290
+ ['<', 14, 0],
291
+ ['<', 15, 0],
292
+ ['<', 16, 0],
293
+ ['<', 17, 0],
294
+ ['<', 18, 0],
295
+ ['<', 19, 0],
296
+ ['<', 20, 0],
297
+ ['<', 21, 0],
298
+ ['<', 22, 0],
299
+ ['<', 23, 0],
300
+ ['<', 24, 0],
301
+ ['<', 25, 0],
302
+ ['<', 26, 0],
303
+ ['<', 27, 0],
304
+ ['<', 28, 0]
305
305
  ]
306
306
 
307
- it_has_behavior "with a #change callback", s1, s2, result
308
- it_has_behavior "without a #change callback", s1, s2, result
307
+ it_has_behavior 'with a #change callback', s1, s2, result
308
+ it_has_behavior 'without a #change callback', s1, s2, result
309
309
  end
310
310
  end
@@ -1,10 +1,10 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe "Diff::LCS.traverse_sequences" do
6
- describe "callback with no finishers" do
7
- describe "over (seq1, seq2)" do
5
+ describe 'Diff::LCS.traverse_sequences' do
6
+ describe 'callback with no finishers' do
7
+ describe 'over (seq1, seq2)' do
8
8
  before(:each) do
9
9
  @callback_s1_s2 = simple_callback_no_finishers
10
10
  Diff::LCS.traverse_sequences(seq1, seq2, @callback_s1_s2)
@@ -13,27 +13,27 @@ describe "Diff::LCS.traverse_sequences" do
13
13
  Diff::LCS.traverse_sequences(seq2, seq1, @callback_s2_s1)
14
14
  end
15
15
 
16
- it "has the correct LCS result on left-matches" do
16
+ it 'has the correct LCS result on left-matches' do
17
17
  expect(@callback_s1_s2.matched_a).to eq(correct_lcs)
18
18
  expect(@callback_s2_s1.matched_a).to eq(correct_lcs)
19
19
  end
20
20
 
21
- it "has the correct LCS result on right-matches" do
21
+ it 'has the correct LCS result on right-matches' do
22
22
  expect(@callback_s1_s2.matched_b).to eq(correct_lcs)
23
23
  expect(@callback_s2_s1.matched_b).to eq(correct_lcs)
24
24
  end
25
25
 
26
- it "has the correct skipped sequences with the left sequence" do
26
+ it 'has the correct skipped sequences with the left sequence' do
27
27
  expect(@callback_s1_s2.discards_a).to eq(skipped_seq1)
28
28
  expect(@callback_s2_s1.discards_a).to eq(skipped_seq2)
29
29
  end
30
30
 
31
- it "has the correct skipped sequences with the right sequence" do
31
+ it 'has the correct skipped sequences with the right sequence' do
32
32
  expect(@callback_s1_s2.discards_b).to eq(skipped_seq2)
33
33
  expect(@callback_s2_s1.discards_b).to eq(skipped_seq1)
34
34
  end
35
35
 
36
- it "does not have anything done markers from the left or right sequences" do
36
+ it 'does not have anything done markers from the left or right sequences' do
37
37
  expect(@callback_s1_s2.done_a).to be_empty
38
38
  expect(@callback_s1_s2.done_b).to be_empty
39
39
  expect(@callback_s2_s1.done_a).to be_empty
@@ -41,64 +41,64 @@ describe "Diff::LCS.traverse_sequences" do
41
41
  end
42
42
  end
43
43
 
44
- describe "over (hello, hello)" do
44
+ describe 'over (hello, hello)' do
45
45
  before(:each) do
46
46
  @callback = simple_callback_no_finishers
47
47
  Diff::LCS.traverse_sequences(hello, hello, @callback)
48
48
  end
49
49
 
50
- it "has the correct LCS result on left-matches" do
50
+ it 'has the correct LCS result on left-matches' do
51
51
  expect(@callback.matched_a).to eq(hello.split(//))
52
52
  end
53
53
 
54
- it "has the correct LCS result on right-matches" do
54
+ it 'has the correct LCS result on right-matches' do
55
55
  expect(@callback.matched_b).to eq(hello.split(//))
56
56
  end
57
57
 
58
- it "has the correct skipped sequences with the left sequence", :only => true do
58
+ it 'has the correct skipped sequences with the left sequence', :only => true do
59
59
  expect(@callback.discards_a).to be_empty
60
60
  end
61
61
 
62
- it "has the correct skipped sequences with the right sequence" do
62
+ it 'has the correct skipped sequences with the right sequence' do
63
63
  expect(@callback.discards_b).to be_empty
64
64
  end
65
65
 
66
- it "does not have anything done markers from the left or right sequences" do
66
+ it 'does not have anything done markers from the left or right sequences' do
67
67
  expect(@callback.done_a).to be_empty
68
68
  expect(@callback.done_b).to be_empty
69
69
  end
70
70
  end
71
71
 
72
- describe "over (hello_ary, hello_ary)" do
72
+ describe 'over (hello_ary, hello_ary)' do
73
73
  before(:each) do
74
74
  @callback = simple_callback_no_finishers
75
75
  Diff::LCS.traverse_sequences(hello_ary, hello_ary, @callback)
76
76
  end
77
77
 
78
- it "has the correct LCS result on left-matches" do
78
+ it 'has the correct LCS result on left-matches' do
79
79
  expect(@callback.matched_a).to eq(hello_ary)
80
80
  end
81
81
 
82
- it "has the correct LCS result on right-matches" do
82
+ it 'has the correct LCS result on right-matches' do
83
83
  expect(@callback.matched_b).to eq(hello_ary)
84
84
  end
85
85
 
86
- it "has the correct skipped sequences with the left sequence" do
86
+ it 'has the correct skipped sequences with the left sequence' do
87
87
  expect(@callback.discards_a).to be_empty
88
88
  end
89
89
 
90
- it "has the correct skipped sequences with the right sequence" do
90
+ it 'has the correct skipped sequences with the right sequence' do
91
91
  expect(@callback.discards_b).to be_empty
92
92
  end
93
93
 
94
- it "does not have anything done markers from the left or right sequences" do
94
+ it 'does not have anything done markers from the left or right sequences' do
95
95
  expect(@callback.done_a).to be_empty
96
96
  expect(@callback.done_b).to be_empty
97
97
  end
98
98
  end
99
99
  end
100
100
 
101
- describe "callback with finisher" do
101
+ describe 'callback with finisher' do
102
102
  before(:each) do
103
103
  @callback_s1_s2 = simple_callback
104
104
  Diff::LCS.traverse_sequences(seq1, seq2, @callback_s1_s2)
@@ -106,34 +106,32 @@ describe "Diff::LCS.traverse_sequences" do
106
106
  Diff::LCS.traverse_sequences(seq2, seq1, @callback_s2_s1)
107
107
  end
108
108
 
109
- it "has the correct LCS result on left-matches" do
109
+ it 'has the correct LCS result on left-matches' do
110
110
  expect(@callback_s1_s2.matched_a).to eq(correct_lcs)
111
111
  expect(@callback_s2_s1.matched_a).to eq(correct_lcs)
112
112
  end
113
113
 
114
- it "has the correct LCS result on right-matches" do
114
+ it 'has the correct LCS result on right-matches' do
115
115
  expect(@callback_s1_s2.matched_b).to eq(correct_lcs)
116
116
  expect(@callback_s2_s1.matched_b).to eq(correct_lcs)
117
117
  end
118
118
 
119
- it "has the correct skipped sequences for the left sequence" do
119
+ it 'has the correct skipped sequences for the left sequence' do
120
120
  expect(@callback_s1_s2.discards_a).to eq(skipped_seq1)
121
121
  expect(@callback_s2_s1.discards_a).to eq(skipped_seq2)
122
122
  end
123
123
 
124
- it "has the correct skipped sequences for the right sequence" do
124
+ it 'has the correct skipped sequences for the right sequence' do
125
125
  expect(@callback_s1_s2.discards_b).to eq(skipped_seq2)
126
126
  expect(@callback_s2_s1.discards_b).to eq(skipped_seq1)
127
127
  end
128
128
 
129
- it "has done markers differently-sized sequences" do
130
- expect(@callback_s1_s2.done_a).to eq([[ "p", 9, "s", 10 ]])
129
+ it 'has done markers differently-sized sequences' do
130
+ expect(@callback_s1_s2.done_a).to eq([['p', 9, 't', 11]])
131
131
  expect(@callback_s1_s2.done_b).to be_empty
132
132
 
133
- # 20110731 I don't yet understand why this particular behaviour
134
- # isn't transitive.
135
133
  expect(@callback_s2_s1.done_a).to be_empty
136
- expect(@callback_s2_s1.done_b).to be_empty
134
+ expect(@callback_s2_s1.done_b).to eq([['t', 11, 'p', 9]])
137
135
  end
138
136
  end
139
137
  end