diff-lcs 1.3 → 1.4.4
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 +5 -5
- data/Contributing.md +83 -48
- data/History.md +252 -153
- data/Manifest.txt +8 -0
- data/README.rdoc +10 -10
- data/Rakefile +39 -22
- data/autotest/discover.rb +3 -1
- data/bin/htmldiff +7 -4
- data/bin/ldiff +4 -1
- data/lib/diff-lcs.rb +1 -1
- data/lib/diff/lcs.rb +184 -170
- data/lib/diff/lcs/array.rb +1 -1
- data/lib/diff/lcs/backports.rb +9 -0
- data/lib/diff/lcs/block.rb +1 -1
- data/lib/diff/lcs/callbacks.rb +15 -12
- data/lib/diff/lcs/change.rb +30 -37
- data/lib/diff/lcs/htmldiff.rb +17 -16
- data/lib/diff/lcs/hunk.rb +156 -74
- data/lib/diff/lcs/internals.rb +36 -39
- data/lib/diff/lcs/ldiff.rb +46 -42
- data/lib/diff/lcs/string.rb +1 -1
- data/spec/change_spec.rb +31 -7
- data/spec/diff_spec.rb +16 -12
- data/spec/fixtures/aX +1 -0
- data/spec/fixtures/bXaX +1 -0
- data/spec/fixtures/ldiff/output.diff +4 -0
- data/spec/fixtures/ldiff/output.diff-c +7 -0
- data/spec/fixtures/ldiff/output.diff-e +3 -0
- data/spec/fixtures/ldiff/output.diff-f +3 -0
- data/spec/fixtures/ldiff/output.diff-u +5 -0
- data/spec/hunk_spec.rb +37 -26
- data/spec/issues_spec.rb +115 -10
- data/spec/lcs_spec.rb +10 -10
- data/spec/ldiff_spec.rb +71 -31
- data/spec/patch_spec.rb +93 -99
- data/spec/sdiff_spec.rb +89 -89
- data/spec/spec_helper.rb +118 -64
- data/spec/traverse_balanced_spec.rb +173 -173
- data/spec/traverse_sequences_spec.rb +28 -28
- metadata +31 -30
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
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
|
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
|
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
|
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
|
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,28 +106,28 @@ 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, 's', 10]])
|
131
131
|
expect(@callback_s1_s2.done_b).to be_empty
|
132
132
|
|
133
133
|
# 20110731 I don't yet understand why this particular behaviour
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff-lcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hoe-doofus
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: hoe-travis
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.2'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.2'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rspec
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
version: '10.0'
|
110
96
|
- - "<"
|
111
97
|
- !ruby/object:Gem::Version
|
112
|
-
version: '
|
98
|
+
version: '14'
|
113
99
|
type: :development
|
114
100
|
prerelease: false
|
115
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -119,7 +105,7 @@ dependencies:
|
|
119
105
|
version: '10.0'
|
120
106
|
- - "<"
|
121
107
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
108
|
+
version: '14'
|
123
109
|
- !ruby/object:Gem::Dependency
|
124
110
|
name: rdoc
|
125
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,23 +126,28 @@ dependencies:
|
|
140
126
|
requirements:
|
141
127
|
- - "~>"
|
142
128
|
- !ruby/object:Gem::Version
|
143
|
-
version: '3.
|
129
|
+
version: '3.22'
|
144
130
|
type: :development
|
145
131
|
prerelease: false
|
146
132
|
version_requirements: !ruby/object:Gem::Requirement
|
147
133
|
requirements:
|
148
134
|
- - "~>"
|
149
135
|
- !ruby/object:Gem::Version
|
150
|
-
version: '3.
|
136
|
+
version: '3.22'
|
151
137
|
description: |-
|
152
138
|
Diff::LCS computes the difference between two Enumerable sequences using the
|
153
139
|
McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
|
154
140
|
to create a simple HTML diff output format and a standard diff-like tool.
|
155
141
|
|
156
|
-
This is release 1.3, providing a
|
157
|
-
|
158
|
-
|
159
|
-
|
142
|
+
This is release 1.4.3, providing a simple extension that allows for
|
143
|
+
Diff::LCS::Change objects to be treated implicitly as arrays and fixes a
|
144
|
+
number of formatting issues.
|
145
|
+
|
146
|
+
Ruby versions below 2.5 are soft-deprecated, which means that older versions
|
147
|
+
are no longer part of the CI test suite. If any changes have been introduced
|
148
|
+
that break those versions, bug reports and patches will be accepted, but it
|
149
|
+
will be up to the reporter to verify any fixes prior to release. The next
|
150
|
+
major release will completely break compatibility.
|
160
151
|
email:
|
161
152
|
- halostatue@gmail.com
|
162
153
|
executables:
|
@@ -189,6 +180,7 @@ files:
|
|
189
180
|
- lib/diff-lcs.rb
|
190
181
|
- lib/diff/lcs.rb
|
191
182
|
- lib/diff/lcs/array.rb
|
183
|
+
- lib/diff/lcs/backports.rb
|
192
184
|
- lib/diff/lcs/block.rb
|
193
185
|
- lib/diff/lcs/callbacks.rb
|
194
186
|
- lib/diff/lcs/change.rb
|
@@ -199,8 +191,15 @@ files:
|
|
199
191
|
- lib/diff/lcs/string.rb
|
200
192
|
- spec/change_spec.rb
|
201
193
|
- spec/diff_spec.rb
|
194
|
+
- spec/fixtures/aX
|
195
|
+
- spec/fixtures/bXaX
|
202
196
|
- spec/fixtures/ds1.csv
|
203
197
|
- spec/fixtures/ds2.csv
|
198
|
+
- spec/fixtures/ldiff/output.diff
|
199
|
+
- spec/fixtures/ldiff/output.diff-c
|
200
|
+
- spec/fixtures/ldiff/output.diff-e
|
201
|
+
- spec/fixtures/ldiff/output.diff-f
|
202
|
+
- spec/fixtures/ldiff/output.diff-u
|
204
203
|
- spec/hunk_spec.rb
|
205
204
|
- spec/issues_spec.rb
|
206
205
|
- spec/lcs_spec.rb
|
@@ -215,8 +214,11 @@ licenses:
|
|
215
214
|
- MIT
|
216
215
|
- Artistic-2.0
|
217
216
|
- GPL-2.0+
|
218
|
-
metadata:
|
219
|
-
|
217
|
+
metadata:
|
218
|
+
homepage_uri: https://github.com/halostatue/diff-lcs
|
219
|
+
source_code_uri: https://github.com/halostatue/diff-lcs
|
220
|
+
bug_tracker_uri: https://github.com/halostatue/diff-lcs/issues
|
221
|
+
post_install_message:
|
220
222
|
rdoc_options:
|
221
223
|
- "--main"
|
222
224
|
- README.rdoc
|
@@ -233,9 +235,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
235
|
- !ruby/object:Gem::Version
|
234
236
|
version: '0'
|
235
237
|
requirements: []
|
236
|
-
|
237
|
-
|
238
|
-
signing_key:
|
238
|
+
rubygems_version: 3.0.3
|
239
|
+
signing_key:
|
239
240
|
specification_version: 4
|
240
241
|
summary: Diff::LCS computes the difference between two Enumerable sequences using
|
241
242
|
the McIlroy-Hunt longest common subsequence (LCS) algorithm
|