unified_diff 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19a9a1b715b01049a5ccabf9e9e86feb84042fbd
4
- data.tar.gz: c3b9153ea0080ff4b5b1db815f13f63259299d48
3
+ metadata.gz: 5c097d48e44a0fe16367b5522145d280ccf3772c
4
+ data.tar.gz: d3d26d208a1d2941595137c4ec2356f53f863e88
5
5
  SHA512:
6
- metadata.gz: 4a3eeca0762bb242e46625f0730f94fdfd85c048ce7a6bcb548a50d68f9161c9ed16025d3eeec655d6fda1977cf9e5d0554b46a2f1c6336d518910a2715f9902
7
- data.tar.gz: f6c3a7e5e05deb85ecaac34641804c39333634a8a2ea65c95635965f64bdd7faf247c47acb8dd17e5989ae3ca3b0e43da2bce4da1e71672be8e28229ac246af0
6
+ metadata.gz: 74b9087bf68d10c2c7e1c7d8a8a10b1b416ffed7d0e846481d4f902846e04d1f2b4da6d8ee798e0cac85807bed7398d58117b33c8e1ffa1d27d051d1dad37c36
7
+ data.tar.gz: 8f17bc3572c9fbd896aa45e69b3d8be26eb4c5411cb424a11b9fe78a9fa45fd43032300f6a14cb119a3d6d782805d308c7d5a2889e6e4388a8e6afa227c97bf2
@@ -1,19 +1,23 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.5)
4
+ addressable (2.3.6)
5
5
  builder (3.2.2)
6
- faraday (0.7.6)
7
- addressable (~> 2.2)
8
- multipart-post (~> 1.1)
9
- rack (~> 1.1)
10
- git (1.2.6)
11
- github_api (0.4.10)
12
- faraday (~> 0.7.6)
13
- hashie (~> 1.2.0)
14
- multi_json (~> 1.0)
15
- oauth2 (~> 0.5.2)
16
- hashie (1.2.0)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ docile (1.1.5)
9
+ faraday (0.9.0)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.2.8)
12
+ github_api (0.12.0)
13
+ addressable (~> 2.3)
14
+ descendants_tracker (~> 0.0.4)
15
+ faraday (~> 0.8, < 0.10)
16
+ hashie (>= 3.2)
17
+ multi_json (>= 1.7.5, < 2.0)
18
+ nokogiri (~> 1.6.3)
19
+ oauth2
20
+ hashie (3.2.0)
17
21
  highline (1.6.21)
18
22
  jeweler (2.0.1)
19
23
  builder
@@ -25,23 +29,30 @@ GEM
25
29
  rake
26
30
  rdoc
27
31
  json (1.8.1)
28
- mini_portile (0.5.2)
29
- minitest (3.4.0)
30
- multi_json (1.3.6)
31
- multipart-post (1.2.0)
32
- nokogiri (1.6.1)
33
- mini_portile (~> 0.5.0)
34
- oauth2 (0.5.2)
35
- faraday (~> 0.7)
36
- multi_json (~> 1.0)
32
+ jwt (1.0.0)
33
+ mini_portile (0.6.0)
34
+ minitest (5.4.0)
35
+ multi_json (1.10.1)
36
+ multi_xml (0.5.5)
37
+ multipart-post (2.0.0)
38
+ nokogiri (1.6.3.1)
39
+ mini_portile (= 0.6.0)
40
+ oauth2 (1.0.0)
41
+ faraday (>= 0.8, < 0.10)
42
+ jwt (~> 1.0)
43
+ multi_json (~> 1.3)
44
+ multi_xml (~> 0.5)
45
+ rack (~> 1.2)
37
46
  rack (1.5.2)
38
- rake (10.1.1)
47
+ rake (10.3.2)
39
48
  rdoc (4.1.1)
40
49
  json (~> 1.4)
41
- simplecov (0.6.4)
42
- multi_json (~> 1.0)
43
- simplecov-html (~> 0.5.3)
44
- simplecov-html (0.5.3)
50
+ simplecov (0.9.0)
51
+ docile (~> 1.1.0)
52
+ multi_json
53
+ simplecov-html (~> 0.8.0)
54
+ simplecov-html (0.8.0)
55
+ thread_safe (0.3.4)
45
56
 
46
57
  PLATFORMS
47
58
  ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -5,8 +5,8 @@ module UnifiedDiff
5
5
  class UnifiedDiffException < Exception; end
6
6
 
7
7
  FILE_PATTERN = /([^\t\n]+)(?:\t'{2}?([^']+)'{2}?)?/
8
- OLD_FILE_PATTERN = /--- #{FILE_PATTERN}/
9
- NEW_FILE_PATTERN = /\+\+\+ #{FILE_PATTERN}/
8
+ OLD_FILE_PATTERN = /^--- #{FILE_PATTERN}/
9
+ NEW_FILE_PATTERN = /^\+\+\+ #{FILE_PATTERN}/
10
10
  # Match assignment is tricky for CHUNK_PATTERN
11
11
  # $1 and $3 are static, but $2 and $4 can be nil
12
12
  #
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestChunk < MiniTest::Unit::TestCase
3
+ class TestChunk < Minitest::Test
4
4
  def setup
5
5
  @chunk = UnifiedDiff::Chunk.new(original: (1..2), modified: (1..3))
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestUnifiedDiff < MiniTest::Unit::TestCase
3
+ class TestUnifiedDiff < Minitest::Test
4
4
  def setup
5
5
  @original = <<-DIFF.unindent
6
6
  --- original.txt 2011-05-31 11:14:13.000000000 -0500
@@ -147,7 +147,7 @@ class TestUnifiedDiff < MiniTest::Unit::TestCase
147
147
  # containing one line:
148
148
  # foo
149
149
  #
150
- # and
150
+ # and
151
151
  # odd_line_modified
152
152
  # containing five lines:
153
153
  # foo
@@ -178,7 +178,7 @@ class TestUnifiedDiff < MiniTest::Unit::TestCase
178
178
  # Hand modified git diff -U of this file to create this diff.
179
179
  # The git version of unified does not have a timestamp after
180
180
  # the filename.
181
- #
181
+ #
182
182
  # The lines:
183
183
  # --- a/test/test_unified_diff.rb 2012-09-06 16:56:08.320483113 -0400
184
184
  # +++ b/test/test_unified_diff.rb 2012-09-06 16:56:44.488483939 -0400
@@ -189,7 +189,7 @@ class TestUnifiedDiff < MiniTest::Unit::TestCase
189
189
  diff = <<-DIFF.unindent
190
190
  --- a/test/test_unified_diff.rb 2012-09-06 16:56:08.320483113 -0400
191
191
  +++ b/test/test_unified_diff.rb 2012-09-06 16:56:44.488483939 -0400
192
- @@ -5,7 +5,7 @@ class TestUnifiedDiff < MiniTest::Unit::TestCase
192
+ @@ -5,7 +5,7 @@ class TestUnifiedDiff < Minitest::Test
193
193
  @original = <<-DIFF.unindent
194
194
  --- original.txt 2011-05-31 11:14:13.000000000 -0500
195
195
  +++ modified.txt 2011-05-31 11:14:44.000000000 -0500
@@ -207,8 +207,8 @@ class TestUnifiedDiff < MiniTest::Unit::TestCase
207
207
 
208
208
  def test_no_newline_at_eof
209
209
  header = <<-HEADER.unindent
210
- --- a 2014-02-26 16:19:13.000000000 -0800
211
- +++ b 2014-02-26 16:19:13.000000000 -0800
210
+ --- a 2014-02-26 16:19:13.000000000 -0800
211
+ +++ b 2014-02-26 16:19:13.000000000 -0800
212
212
  HEADER
213
213
 
214
214
  chunk = <<-'CHUNK'.unindent
@@ -225,4 +225,47 @@ class TestUnifiedDiff < MiniTest::Unit::TestCase
225
225
  assert_equal ["noel"], @chunk.original_lines
226
226
  assert_equal ["noll"], @chunk.modified_lines
227
227
  end
228
+
229
+ def test_pluses
230
+ header = <<-HEADER.unindent
231
+ --- a 2014-07-26 21:44:41.068596411 -0700
232
+ +++ b 2014-08-03 05:18:34.411245070 -0700
233
+ HEADER
234
+
235
+ chunk = <<-'CHUNK'.unindent
236
+ @@ -0,0 +1,5 @@
237
+ ++++++++ ++++++ +++
238
+ ++ some heading
239
+ + stuff +++++++++ stuff
240
+ ++++ a
241
+ +some body
242
+ CHUNK
243
+
244
+ @diff = UnifiedDiff.parse(header + chunk)
245
+ @chunk = @diff.chunks.first
246
+ assert_equal chunk, @chunk.to_s
247
+ assert_equal 5, @chunk.added_lines.length
248
+ end
249
+
250
+ def test_hyphens
251
+ header = <<-HEADER.unindent
252
+ --- a 2014-07-26 21:44:41.068596411 -0700
253
+ +++ b 2014-08-03 05:18:34.411245070 -0700
254
+ HEADER
255
+
256
+ chunk = <<-'CHUNK'.unindent
257
+ @@ -1,5 +0,0 @@
258
+ -------- ------ ---
259
+ -- some heading
260
+ - stuff --------- stuff
261
+ ---- a
262
+ -some body
263
+ CHUNK
264
+
265
+ @diff = UnifiedDiff.parse(header + chunk)
266
+ @chunk = @diff.chunks.first
267
+ assert_equal chunk, @chunk.to_s
268
+ assert_equal 5, @chunk.removed_lines.length
269
+ end
270
+
228
271
  end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: unified_diff 0.3.5 ruby lib
5
+ # stub: unified_diff 0.3.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "unified_diff"
9
- s.version = "0.3.5"
9
+ s.version = "0.3.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unified_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Neufeld