diff 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('diff','0.3.3') do |s|
5
+ Echoe.new('diff','0.3.4') do |s|
6
6
  s.description = "Diff Algorithm Implementation"
7
7
  s.url = "http://users.cybercity.dk/~dsl8950/ruby/diff.html"
8
8
  s.author = "Wayne Walter"
data/diff.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{diff}
5
- s.version = "0.3.3"
5
+ s.version = "0.3.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Wayne Walter"]
data/lib/emaildiff.rb CHANGED
@@ -44,7 +44,7 @@ module HTMLCollapsable
44
44
  Diff.new(self, b)
45
45
  end
46
46
 
47
- def patch(diff,starttoken,endtoken)
47
+ def patch_email(diff,starttoken,endtoken)
48
48
  newary = nil
49
49
  if diff.difftype == String
50
50
  newary = diff.difftype.new('')
@@ -63,7 +63,7 @@ module HTMLCollapsable
63
63
  end
64
64
  newary << starttoken if quoted == 1
65
65
  while ai < mod[1]
66
- newary << diff.orig_a[ai]
66
+ newary << diff.orig_b[bi]
67
67
  ai += 1
68
68
  bi += 1
69
69
  end
@@ -75,7 +75,7 @@ module HTMLCollapsable
75
75
  end
76
76
  newary << starttoken if quoted == 1
77
77
  while bi < mod[1]
78
- newary << diff.orig_a[ai]
78
+ newary << diff.orig_b[bi]
79
79
  ai += 1
80
80
  bi += 1
81
81
  end
@@ -93,7 +93,7 @@ module HTMLCollapsable
93
93
  end
94
94
  newary << starttoken if quoted == 1
95
95
  while ai < self.length
96
- newary << diff.orig_a[ai]
96
+ newary << diff.orig_b[bi]
97
97
  ai += 1
98
98
  bi += 1
99
99
  end
@@ -1,68 +1,69 @@
1
- module DiffArrayTests
1
+ module EmailDiffArrayTests
2
+
2
3
  def test_array_quoted
3
- difftest ["1","2","3"], [">1",">2",">3","4"], [888,">1",">2",">3",999,"4"]
4
- difftest ["1","2","3"], [">1",">2",">3","4","5"], [888,">1",">2",">3",999,"4","5"]
4
+ emailtest ["1","2","3"], [">1",">2",">3","4"], [888,">1",">2",">3",999,"4"]
5
+ emailtest ["1","2","3"], [">1",">2",">3","4","5"], [888,">1",">2",">3",999,"4","5"]
5
6
  end
6
7
 
7
- def test_array_quoted
8
- difftest ["1","2","3"], [">1",">2",">3","4"], [888,">1",">2",">3",999,"4"]
9
- difftest ["1"," > 2"," > 3"], [">1","> > 2","> > 3","4","5"], [888,">1","> > 2","> > 3",999,"4","5"]
8
+ def test_array_double_quoted
9
+ emailtest ["1","2","3"], [">1",">2",">3","4"], [888,">1",">2",">3",999,"4"]
10
+ emailtest ["1"," > 2"," > 3"], [">1","> > 2","> > 3","4","5"], [888,">1","> > 2","> > 3",999,"4","5"]
10
11
  end
11
12
 
12
13
  def test_array_append
13
- difftest [1,2,3], [1,2,3,4], [888,1,2,3,999,4]
14
- difftest [1,2,3], [1,2,3,4,5], [888,1,2,3,999,4,5]
14
+ emailtest [1,2,3], [1,2,3,4], [888,1,2,3,999,4]
15
+ emailtest [1,2,3], [1,2,3,4,5], [888,1,2,3,999,4,5]
15
16
  end
16
17
 
17
18
  def test_array_prepend
18
- difftest [1,2,3], [0,1,2,3], [0,888,1,2,3,999]
19
- difftest [1,2,3], [-1,0,1,2,3], [-1,0,888,1,2,3,999]
19
+ emailtest [1,2,3], [0,1,2,3], [0,888,1,2,3,999]
20
+ emailtest [1,2,3], [-1,0,1,2,3], [-1,0,888,1,2,3,999]
20
21
  end
21
22
 
22
23
  def test_array_insert
23
- difftest [1,2,3], [1,2,4,3], [888,1,2,999,4,888,3,999]
24
- difftest [1,2,3], [1,2,4,5,3], [888,1,2,999,4,5,888,3,999]
24
+ emailtest [1,2,3], [1,2,4,3], [888,1,2,999,4,888,3,999]
25
+ emailtest [1,2,3], [1,2,4,5,3], [888,1,2,999,4,5,888,3,999]
25
26
  end
26
27
 
27
28
  def test_array_remove
28
- difftest [1,2,3], [1,3], [888,1,999,888,3,999]
29
+ emailtest [1,2,3], [1,3], [888,1,999,888,3,999]
29
30
 
30
31
  end
31
32
 
32
33
  def test_array_cutfront
33
- difftest [1,2,3], [2,3], [888,2,3,999]
34
- difftest [1,2,3], [3], [888,3,999]
34
+ emailtest [1,2,3], [2,3], [888,2,3,999]
35
+ emailtest [1,2,3], [3], [888,3,999]
35
36
  end
36
37
 
37
38
  def test_array_cutback
38
- difftest [1,2,3], [1,2], [888,1,2,999]
39
- difftest [1,2,3], [1], [888,1,999]
39
+ emailtest [1,2,3], [1,2], [888,1,2,999]
40
+ emailtest [1,2,3], [1], [888,1,999]
40
41
  end
41
42
 
42
43
  def test_array_empty
43
- difftest [1,2,3], [], []
44
+ emailtest [1,2,3], [], []
44
45
  end
45
46
 
46
47
  def test_array_fill
47
- difftest [], [1,2,3], [1,2,3]
48
+ emailtest [], [1,2,3], [1,2,3]
48
49
  end
49
50
 
50
51
  def test_array_change
51
- difftest [1,2,3], [1,4,3], [888,1,999,4,888,3,999]
52
- difftest [1,2,3], [1,4,5], [888,1,999,4,5]
53
- difftest [1,2,3,4], [1,5,4], [888,1,999,5,888,4,999]
52
+ emailtest [1,2,3], [1,4,3], [888,1,999,4,888,3,999]
53
+ emailtest [1,2,3], [1,4,5], [888,1,999,4,5]
54
+ emailtest [1,2,3,4], [1,5,4], [888,1,999,5,888,4,999]
54
55
  end
55
56
 
56
57
  def test_array_noop
57
- difftest [1,2,3], [1,2,3], [888,1,2,3,999]
58
+ emailtest [1,2,3], [1,2,3], [888,1,2,3,999]
58
59
  end
59
60
 
60
61
  def test_array_grow
61
- difftest [1,2,3], [4,1,5,2,6,3,7], [4,888,1,999,5,888,2,999,6,888,3,999,7]
62
+ emailtest [1,2,3], [4,1,5,2,6,3,7], [4,888,1,999,5,888,2,999,6,888,3,999,7]
62
63
  end
63
64
 
64
65
  def test_array_shrink
65
- difftest [1,2,3,4,5,6,7], [2,4,6], [888,2,999,888,4,999,888,6,999]
66
+ emailtest [1,2,3,4,5,6,7], [2,4,6], [888,2,999,888,4,999,888,6,999]
66
67
  end
67
68
 
68
69
  end
@@ -7,14 +7,14 @@ require 'test_emailcases'
7
7
 
8
8
  class EmailDiffTest < RUNIT::TestCase
9
9
 
10
- include DiffArrayTests
11
- def difftest(a, b, c)
10
+ include EmailDiffArrayTests
11
+ def emailtest(a, b, c)
12
12
  #puts "old string:"
13
13
  #puts a
14
14
  #puts "new string:"
15
15
  #puts b
16
16
  diff = EmailDiff.new(a, b)
17
- d = a.patch(diff,888,999)
17
+ d = a.patch_email(diff,888,999)
18
18
  #puts "result:"
19
19
  #puts d
20
20
  assert_equal(c,d)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 3
9
- version: 0.3.3
8
+ - 4
9
+ version: 0.3.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Wayne Walter
metadata.gz.sig CHANGED
Binary file