diff-lcs 1.4.4 → 1.5.1
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.
- checksums.yaml +4 -4
- data/Contributing.md +3 -0
- data/History.md +219 -107
- data/License.md +6 -4
- data/Manifest.txt +15 -1
- data/Rakefile +81 -25
- data/bin/htmldiff +4 -4
- data/lib/diff/lcs/array.rb +1 -1
- data/lib/diff/lcs/backports.rb +2 -2
- data/lib/diff/lcs/block.rb +4 -4
- data/lib/diff/lcs/callbacks.rb +9 -7
- data/lib/diff/lcs/change.rb +19 -19
- data/lib/diff/lcs/htmldiff.rb +24 -16
- data/lib/diff/lcs/hunk.rb +35 -30
- data/lib/diff/lcs/internals.rb +24 -20
- data/lib/diff/lcs/ldiff.rb +37 -35
- data/lib/diff/lcs.rb +77 -75
- data/lib/diff-lcs.rb +1 -1
- data/spec/change_spec.rb +50 -50
- data/spec/diff_spec.rb +14 -14
- data/spec/fixtures/ldiff/output.diff.chef +4 -0
- data/spec/fixtures/ldiff/output.diff.chef-c +15 -0
- data/spec/fixtures/ldiff/output.diff.chef-e +3 -0
- data/spec/fixtures/ldiff/output.diff.chef-f +3 -0
- data/spec/fixtures/ldiff/output.diff.chef-u +9 -0
- data/spec/fixtures/ldiff/output.diff.chef2 +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
- data/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
- data/spec/fixtures/new-chef +4 -0
- data/spec/fixtures/new-chef2 +17 -0
- data/spec/fixtures/old-chef +4 -0
- data/spec/fixtures/old-chef2 +14 -0
- data/spec/hunk_spec.rb +19 -19
- data/spec/issues_spec.rb +48 -42
- data/spec/lcs_spec.rb +11 -11
- data/spec/ldiff_spec.rb +13 -11
- data/spec/patch_spec.rb +84 -84
- data/spec/sdiff_spec.rb +111 -109
- data/spec/spec_helper.rb +77 -76
- data/spec/traverse_balanced_spec.rb +191 -189
- data/spec/traverse_sequences_spec.rb +31 -33
- metadata +50 -23
- data/autotest/discover.rb +0 -3
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
|
-
describe
|
6
|
-
describe
|
7
|
-
describe
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
51
|
-
expect(@callback.matched_a).to eq(hello.
|
50
|
+
it "has the correct LCS result on left-matches" do
|
51
|
+
expect(@callback.matched_a).to eq(hello.chars)
|
52
52
|
end
|
53
53
|
|
54
|
-
it
|
55
|
-
expect(@callback.matched_b).to eq(hello.
|
54
|
+
it "has the correct LCS result on right-matches" do
|
55
|
+
expect(@callback.matched_b).to eq(hello.chars)
|
56
56
|
end
|
57
57
|
|
58
|
-
it
|
58
|
+
it "has the correct skipped sequences with the left sequence" do
|
59
59
|
expect(@callback.discards_a).to be_empty
|
60
60
|
end
|
61
61
|
|
62
|
-
it
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
130
|
-
expect(@callback_s1_s2.done_a).to eq([[
|
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
|
134
|
+
expect(@callback_s2_s1.done_b).to eq([["t", 11, "p", 9]])
|
137
135
|
end
|
138
136
|
end
|
139
137
|
end
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff-lcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: hoe
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5'
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: hoe-doofus
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +59,19 @@ dependencies:
|
|
39
59
|
- !ruby/object:Gem::Version
|
40
60
|
version: '1.1'
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: hoe-
|
62
|
+
name: hoe-git2
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
44
64
|
requirements:
|
45
65
|
- - "~>"
|
46
66
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
67
|
+
version: '1.7'
|
48
68
|
type: :development
|
49
69
|
prerelease: false
|
50
70
|
version_requirements: !ruby/object:Gem::Requirement
|
51
71
|
requirements:
|
52
72
|
- - "~>"
|
53
73
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
74
|
+
version: '1.7'
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: hoe-rubygems
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,28 +132,20 @@ dependencies:
|
|
112
132
|
requirements:
|
113
133
|
- - ">="
|
114
134
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
135
|
+
version: 6.3.1
|
136
|
+
- - "<"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '7'
|
116
139
|
type: :development
|
117
140
|
prerelease: false
|
118
141
|
version_requirements: !ruby/object:Gem::Requirement
|
119
142
|
requirements:
|
120
143
|
- - ">="
|
121
144
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
123
|
-
-
|
124
|
-
name: hoe
|
125
|
-
requirement: !ruby/object:Gem::Requirement
|
126
|
-
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '3.22'
|
130
|
-
type: :development
|
131
|
-
prerelease: false
|
132
|
-
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - "~>"
|
145
|
+
version: 6.3.1
|
146
|
+
- - "<"
|
135
147
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
148
|
+
version: '7'
|
137
149
|
description: |-
|
138
150
|
Diff::LCS computes the difference between two Enumerable sequences using the
|
139
151
|
McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
|
@@ -172,7 +184,6 @@ files:
|
|
172
184
|
- Manifest.txt
|
173
185
|
- README.rdoc
|
174
186
|
- Rakefile
|
175
|
-
- autotest/discover.rb
|
176
187
|
- bin/htmldiff
|
177
188
|
- bin/ldiff
|
178
189
|
- docs/COPYING.txt
|
@@ -200,6 +211,21 @@ files:
|
|
200
211
|
- spec/fixtures/ldiff/output.diff-e
|
201
212
|
- spec/fixtures/ldiff/output.diff-f
|
202
213
|
- spec/fixtures/ldiff/output.diff-u
|
214
|
+
- spec/fixtures/ldiff/output.diff.chef
|
215
|
+
- spec/fixtures/ldiff/output.diff.chef-c
|
216
|
+
- spec/fixtures/ldiff/output.diff.chef-e
|
217
|
+
- spec/fixtures/ldiff/output.diff.chef-f
|
218
|
+
- spec/fixtures/ldiff/output.diff.chef-u
|
219
|
+
- spec/fixtures/ldiff/output.diff.chef2
|
220
|
+
- spec/fixtures/ldiff/output.diff.chef2-c
|
221
|
+
- spec/fixtures/ldiff/output.diff.chef2-d
|
222
|
+
- spec/fixtures/ldiff/output.diff.chef2-e
|
223
|
+
- spec/fixtures/ldiff/output.diff.chef2-f
|
224
|
+
- spec/fixtures/ldiff/output.diff.chef2-u
|
225
|
+
- spec/fixtures/new-chef
|
226
|
+
- spec/fixtures/new-chef2
|
227
|
+
- spec/fixtures/old-chef
|
228
|
+
- spec/fixtures/old-chef2
|
203
229
|
- spec/hunk_spec.rb
|
204
230
|
- spec/issues_spec.rb
|
205
231
|
- spec/lcs_spec.rb
|
@@ -213,11 +239,12 @@ homepage: https://github.com/halostatue/diff-lcs
|
|
213
239
|
licenses:
|
214
240
|
- MIT
|
215
241
|
- Artistic-2.0
|
216
|
-
- GPL-2.0
|
242
|
+
- GPL-2.0-or-later
|
217
243
|
metadata:
|
218
244
|
homepage_uri: https://github.com/halostatue/diff-lcs
|
219
245
|
source_code_uri: https://github.com/halostatue/diff-lcs
|
220
246
|
bug_tracker_uri: https://github.com/halostatue/diff-lcs/issues
|
247
|
+
rubygems_mfa_required: 'true'
|
221
248
|
post_install_message:
|
222
249
|
rdoc_options:
|
223
250
|
- "--main"
|
@@ -235,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
262
|
- !ruby/object:Gem::Version
|
236
263
|
version: '0'
|
237
264
|
requirements: []
|
238
|
-
rubygems_version: 3.
|
265
|
+
rubygems_version: 3.5.3
|
239
266
|
signing_key:
|
240
267
|
specification_version: 4
|
241
268
|
summary: Diff::LCS computes the difference between two Enumerable sequences using
|
data/autotest/discover.rb
DELETED