diff-lcs 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,21 @@
1
+ == 1.2.3 / 2013-04-11
2
+
3
+ * Bugs Fixed:
4
+ * The new encoding detection for diff output generation (added in 1.2.2)
5
+ introduced a bug if the left side of the comparison was the empty set.
6
+ Originally found in rspec/rspec-expectations#238 and
7
+ rspec/rspec-expectations#239. Jon Rowe developed a reasonable heuristic
8
+ (left side, right side, empty string literal) to avoid this bug.
9
+ https://github.com/rspec/rspec-expectations/pull/238
10
+ https://github.com/rspec/rspec-expectations/pull/239
11
+ * There is a known issue with Rubinius in 1.9 mode reported in
12
+ rubinius/rubinius#2268 and demonstrated in the Travis CI builds. For all
13
+ other tested platforms, diff-lcs is considered stable. As soon as a suitably
14
+ small test-case can be created for the Rubinius team to examine, this will be
15
+ added to the Rubinius issue around this.
16
+ https://github.com/rubinius/rubinius/issues/2268
17
+ https://travis-ci.org/halostatue/diff-lcs/jobs/6241195
18
+
1
19
  == 1.2.2 / 2013-03-30
2
20
 
3
21
  * Bugs Fixed:
@@ -11,9 +11,16 @@ Diff::LCS computes the difference between two Enumerable sequences using the
11
11
  McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
12
12
  to create a simple HTML diff output format and a standard diff-like tool.
13
13
 
14
- This is release 1.2.2, fixing a bug that prevented comparison of values that
15
- are not US-ASCII-compatible. Thanks to Jon Rowe for finding and providing most
16
- of the work behind this issue. This is a recommended release.
14
+ This is release 1.2.3, fixing a bug in value comparison where the left side of
15
+ the comparison was the empty set, preventing the detection of encoding. Thanks
16
+ to Jon Rowe for fixing this issue. This is a strongly recommended release.
17
+
18
+ *Note*: There is a known issue with Rubinius in 1.9 mode reported in
19
+ {rubinius/rubinius#2268}[https://github.com/rubinius/rubinius/issues/2268] and
20
+ demonstrated in the Travis CI builds. For all other tested platforms, diff-lcs
21
+ is considered stable. As soon as a suitably small test-case can be created for
22
+ the Rubinius team to examine, this will be added to the Rubinius issue around
23
+ this.
17
24
 
18
25
  == Synopsis
19
26
 
@@ -1,7 +1,7 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
 
3
3
  module Diff; end unless defined? Diff
4
- # = Diff::LCS 1.2.2
4
+ # = Diff::LCS 1.2.3
5
5
  #
6
6
  # Computes "intelligent" differences between two sequenced Enumerables. This
7
7
  # is an implementation of the McIlroy-Hunt "diff" algorithm for Enumerable
@@ -129,7 +129,7 @@ module Diff; end unless defined? Diff
129
129
  # Common Subsequences</em>, CACM, vol.20, no.5, pp.350-353, May
130
130
  # 1977, with a few minor improvements to improve the speed."
131
131
  module Diff::LCS
132
- VERSION = '1.2.2'
132
+ VERSION = '1.2.3'
133
133
  end
134
134
 
135
135
  require 'diff/lcs/callbacks'
@@ -12,7 +12,7 @@ class Diff::LCS::Hunk
12
12
  # At first, a hunk will have just one Block in it
13
13
  @blocks = [ Diff::LCS::Block.new(piece) ]
14
14
  if String.method_defined?(:encoding)
15
- @preferred_data_encoding = data_old[0].encoding
15
+ @preferred_data_encoding = data_old.fetch(0, data_new.fetch(0,'') ).encoding
16
16
  end
17
17
  @data_old = data_old
18
18
  @data_new = data_new
@@ -15,49 +15,58 @@ describe "Diff::LCS::Hunk" do
15
15
  let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
16
16
 
17
17
  it 'should be able to produce a unified diff from the two pieces' do
18
- expected =
19
- (<<-EOD.encode('UTF-16LE').chomp)
20
- @@ -1,2 +1,2 @@
21
- -Tu avec carté {count} itém has
22
- +Tu avec carte {count} item has
23
- EOD
18
+ expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp)
19
+ @@ -1,2 +1,2 @@
20
+ -Tu avec carté {count} itém has
21
+ +Tu avec carte {count} item has
22
+ EOD
24
23
  expect(hunk.diff(:unified).to_s == expected).to eql true
25
24
  end
26
25
 
27
26
  it 'should be able to produce a context diff from the two pieces' do
28
- expected =
29
- (<<-EOD.encode('UTF-16LE').chomp)
30
- ***************
31
- *** 1,2 ****
32
- !Tu avec carté {count} itém has
33
- --- 1,2 ----
34
- !Tu avec carte {count} item has
35
- EOD
27
+ expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp)
28
+ ***************
29
+ *** 1,2 ****
30
+ !Tu avec carté {count} itém has
31
+ --- 1,2 ----
32
+ !Tu avec carte {count} item has
33
+ EOD
36
34
 
37
35
  expect(hunk.diff(:context).to_s == expected).to eql true
38
36
  end
39
37
 
40
38
  it 'should be able to produce an old diff from the two pieces' do
41
- expected =
42
- (<<-EOD.encode('UTF-16LE').chomp)
43
- 1,2c1,2
44
- < Tu avec carté {count} itém has
45
- ---
46
- > Tu avec carte {count} item has
47
-
48
- EOD
39
+ expected = (<<-EOD.gsub(/^ +/,'').encode('UTF-16LE').chomp)
40
+ 1,2c1,2
41
+ < Tu avec carté {count} itém has
42
+ ---
43
+ > Tu avec carte {count} item has
44
+
45
+ EOD
49
46
  expect(hunk.diff(:old).to_s == expected).to eql true
50
47
  end
51
48
 
52
49
  it 'should be able to produce a reverse ed diff from the two pieces' do
53
- expected =
54
- (<<-EOD.encode('UTF-16LE').chomp)
55
- c1,2
56
- Tu avec carte {count} item has
57
- .
50
+ expected = (<<-EOD.gsub(/^ +/,'').encode('UTF-16LE').chomp)
51
+ c1,2
52
+ Tu avec carte {count} item has
53
+ .
58
54
 
59
- EOD
55
+ EOD
60
56
  expect(hunk.diff(:reverse_ed).to_s == expected).to eql true
61
57
  end
58
+
59
+ context 'with empty first data set' do
60
+ let(:old_data) { [] }
61
+
62
+ it 'should be able to produce a unified diff' do
63
+ expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp)
64
+ @@ -1 +1,2 @@
65
+ +Tu avec carte {count} item has
66
+ EOD
67
+ expect(hunk.diff(:unified).to_s == expected).to eql true
68
+ end
69
+ end
70
+
62
71
  end
63
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff-lcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,7 +50,7 @@ cert_chain:
50
50
  -----END CERTIFICATE-----
51
51
 
52
52
  '
53
- date: 2013-03-30 00:00:00.000000000 Z
53
+ date: 2013-04-12 00:00:00.000000000 Z
54
54
  dependencies:
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubyforge
@@ -236,11 +236,24 @@ description: ! 'Diff::LCS computes the difference between two Enumerable sequenc
236
236
  to create a simple HTML diff output format and a standard diff-like tool.
237
237
 
238
238
 
239
- This is release 1.2.2, fixing a bug that prevented comparison of values that
239
+ This is release 1.2.3, fixing a bug in value comparison where the left side of
240
240
 
241
- are not US-ASCII-compatible. Thanks to Jon Rowe for finding and providing most
241
+ the comparison was the empty set, preventing the detection of encoding. Thanks
242
242
 
243
- of the work behind this issue. This is a recommended release.'
243
+ to Jon Rowe for fixing this issue. This is a strongly recommended release.
244
+
245
+
246
+ *Note*: There is a known issue with Rubinius in 1.9 mode reported in
247
+
248
+ {rubinius/rubinius#2268}[https://github.com/rubinius/rubinius/issues/2268] and
249
+
250
+ demonstrated in the Travis CI builds. For all other tested platforms, diff-lcs
251
+
252
+ is considered stable. As soon as a suitably small test-case can be created for
253
+
254
+ the Rubinius team to examine, this will be added to the Rubinius issue around
255
+
256
+ this.'
244
257
  email:
245
258
  - austin@rubyforge.org
246
259
  executables:
metadata.gz.sig CHANGED
Binary file