diff 0.3.4.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1 +1,5 @@
1
- 4$��I�i��YB+G� w�<b;~L�<�a_�N �Y7�zu:iL�wT�(s��&`y�{�^E�շj7��F)�~��q�Q7���W�o��y�zd~1�Fd׌�p"JSxh�~�h�o�[���dY��co����%�fd�t����.nQA��l�I�?�n��^{�W���.��'a;�5T� Wʍ�����HO�5[�-o������{�:��5_9�)Ӳ��N�a�l�2|�c��F�@�?���I
1
+ Ay��:��F��Ԗ=��V��
2
+ S Ɏ��Ŏ�?�g�6٦[�؆Hلk�K�YvZ�9Ij}���͙ �P�Kp�� x�vk�zJU�7��; ��!��������#Pp�<E����� �ybw�����Y���in���� ��L�Ga�wI���{IϽ_n�s�Y�/�� �.G��
3
+
4
+ ��}�m��M:�� D����&�)��h��G�����H��
5
+ O'���Lw�{C�T�z���WE
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.4.4') do |s|
5
+ Echoe.new('diff','0.3.5') 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"
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{diff}
5
- s.version = "0.3.4.4"
5
+ s.version = "0.3.5"
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"]
9
9
  s.cert_chain = ["/root/.ssh/gem-public_cert.pem"]
10
- s.date = %q{2010-06-27}
10
+ s.date = %q{2010-06-28}
11
11
  s.description = %q{Diff Algorithm Implementation}
12
12
  s.email = %q{diffgem@tickzoom.com}
13
13
  s.extra_rdoc_files = ["README", "TODO", "lib/diff.rb", "lib/emaildiff.rb", "lib/unixdiff.rb"]
@@ -28,12 +28,12 @@ class EmailDiff < Diff
28
28
  newary.each_with_index { |item,index|
29
29
  if item.class == String
30
30
  item = item.dup
31
- item.strip
32
- while item[0] == GREATER
31
+ item = item.strip
32
+ while item[0,1] == ">"
33
33
  item.slice!(0)
34
- item.strip
35
- newary[index] = item
34
+ item = item.strip
36
35
  end
36
+ newary[index] = item
37
37
  end
38
38
  }
39
39
  return newary
@@ -45,7 +45,7 @@ module HTMLCollapsable
45
45
  Diff.new(self, b)
46
46
  end
47
47
 
48
- def patch_email(diff,starttoken,endtoken)
48
+ def patch_email(diff,starttoken = nil,endtoken = nil)
49
49
  newary = nil
50
50
  if diff.difftype == String
51
51
  newary = diff.difftype.new('')
@@ -62,25 +62,25 @@ module HTMLCollapsable
62
62
  if ai < mod[1]
63
63
  quoted = 1
64
64
  end
65
- newary << starttoken if quoted == 1
65
+ newary << starttoken if quoted == 1 && !starttoken.nil?
66
66
  while ai < mod[1]
67
- newary << diff.orig_b[bi]
67
+ newary << diff.orig_b[bi] if !starttoken.nil?
68
68
  ai += 1
69
69
  bi += 1
70
70
  end
71
- newary << endtoken if quoted == 1
71
+ newary << endtoken if quoted == 1 && !starttoken.nil?
72
72
  ai += 1
73
73
  when '+'
74
74
  if bi < mod[1]
75
75
  quoted = 1
76
76
  end
77
- newary << starttoken if quoted == 1
77
+ newary << starttoken if quoted == 1 && !starttoken.nil?
78
78
  while bi < mod[1]
79
- newary << diff.orig_b[bi]
79
+ newary << diff.orig_b[bi] if !starttoken.nil?
80
80
  ai += 1
81
81
  bi += 1
82
82
  end
83
- newary << endtoken if quoted == 1
83
+ newary << endtoken if quoted == 1 && !starttoken.nil?
84
84
  newary << diff.orig_b[mod[1]]
85
85
  bi += 1
86
86
  else
@@ -92,13 +92,13 @@ module HTMLCollapsable
92
92
  if ai < self.length
93
93
  quoted = 1
94
94
  end
95
- newary << starttoken if quoted == 1
95
+ newary << starttoken if quoted == 1 && !starttoken.nil?
96
96
  while ai < self.length
97
- newary << diff.orig_b[bi]
97
+ newary << diff.orig_b[bi] if !starttoken.nil?
98
98
  ai += 1
99
99
  bi += 1
100
100
  end
101
- newary << endtoken if quoted == 1
101
+ newary << endtoken if quoted == 1 && !starttoken.nil?
102
102
  return newary
103
103
  end
104
104
  end
@@ -1,69 +1,92 @@
1
1
  module EmailDiffArrayTests
2
2
 
3
- def test_array_quoted
3
+ def test_array_double_quoted
4
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
+ emailtest ["1"," > 2"," > 3"], [">1","> > 2","> > 3","4","5"], [888,">1","> > 2","> > 3",999,"4","5"]
6
+ emailtest ["1","2","3"], [">1",">2",">3","4"], ["4"], :remove
7
+ emailtest ["1"," > 2"," > 3"], [">1","> > 2","> > 3","4","5"], ["4","5"], :remove
6
8
  end
7
9
 
8
- def test_array_double_quoted
10
+ def test_array_quoted
9
11
  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"]
12
+ emailtest ["1","2","3"], [">1",">2",">3","4","5"], [888,">1",">2",">3",999,"4","5"]
13
+ emailtest ["1","2","3"], [">1",">2",">3","4"], ["4"], :remove
14
+ emailtest ["1","2","3"], [">1",">2",">3","4","5"], ["4","5"], :remove
11
15
  end
12
16
 
13
17
  def test_array_append
14
18
  emailtest [1,2,3], [1,2,3,4], [888,1,2,3,999,4]
15
19
  emailtest [1,2,3], [1,2,3,4,5], [888,1,2,3,999,4,5]
20
+ emailtest [1,2,3], [1,2,3,4], [4], :remove
21
+ emailtest [1,2,3], [1,2,3,4,5], [4,5], :remove
16
22
  end
17
23
 
18
24
  def test_array_prepend
19
25
  emailtest [1,2,3], [0,1,2,3], [0,888,1,2,3,999]
20
26
  emailtest [1,2,3], [-1,0,1,2,3], [-1,0,888,1,2,3,999]
27
+ emailtest [1,2,3], [0,1,2,3], [0,], :remove
28
+ emailtest [1,2,3], [-1,0,1,2,3], [-1,0,], :remove
21
29
  end
22
30
 
23
31
  def test_array_insert
24
32
  emailtest [1,2,3], [1,2,4,3], [888,1,2,999,4,888,3,999]
25
33
  emailtest [1,2,3], [1,2,4,5,3], [888,1,2,999,4,5,888,3,999]
34
+ emailtest [1,2,3], [1,2,4,3], [4,], :remove
35
+ emailtest [1,2,3], [1,2,4,5,3], [4,5], :remove
26
36
  end
27
37
 
28
38
  def test_array_remove
29
39
  emailtest [1,2,3], [1,3], [888,1,999,888,3,999]
40
+ emailtest [1,2,3], [1,3], [], :remove
30
41
 
31
42
  end
32
43
 
33
44
  def test_array_cutfront
34
45
  emailtest [1,2,3], [2,3], [888,2,3,999]
35
46
  emailtest [1,2,3], [3], [888,3,999]
47
+ emailtest [1,2,3], [2,3], [], :remove
48
+ emailtest [1,2,3], [3], [], :remove
36
49
  end
37
50
 
38
51
  def test_array_cutback
39
52
  emailtest [1,2,3], [1,2], [888,1,2,999]
40
53
  emailtest [1,2,3], [1], [888,1,999]
54
+ emailtest [1,2,3], [1,2], [], :remove
55
+ emailtest [1,2,3], [1], [], :remove
41
56
  end
42
57
 
43
58
  def test_array_empty
44
59
  emailtest [1,2,3], [], []
60
+ emailtest [1,2,3], [], [], :remove
45
61
  end
46
62
 
47
63
  def test_array_fill
48
64
  emailtest [], [1,2,3], [1,2,3]
65
+ emailtest [], [1,2,3], [1,2,3], :remove
49
66
  end
50
67
 
51
68
  def test_array_change
52
69
  emailtest [1,2,3], [1,4,3], [888,1,999,4,888,3,999]
53
70
  emailtest [1,2,3], [1,4,5], [888,1,999,4,5]
54
71
  emailtest [1,2,3,4], [1,5,4], [888,1,999,5,888,4,999]
72
+ emailtest [1,2,3], [1,4,3], [4], :remove
73
+ emailtest [1,2,3], [1,4,5], [4,5], :remove
74
+ emailtest [1,2,3,4], [1,5,4], [5], :remove
55
75
  end
56
76
 
57
77
  def test_array_noop
58
78
  emailtest [1,2,3], [1,2,3], [888,1,2,3,999]
79
+ emailtest [1,2,3], [1,2,3], [], :remove
59
80
  end
60
81
 
61
82
  def test_array_grow
62
83
  emailtest [1,2,3], [4,1,5,2,6,3,7], [4,888,1,999,5,888,2,999,6,888,3,999,7]
84
+ emailtest [1,2,3], [4,1,5,2,6,3,7], [4,5,6,7], :remove
63
85
  end
64
86
 
65
87
  def test_array_shrink
66
88
  emailtest [1,2,3,4,5,6,7], [2,4,6], [888,2,999,888,4,999,888,6,999]
89
+ emailtest [1,2,3,4,5,6,7], [2,4,6], [], :remove
67
90
  end
68
91
 
69
92
  end
@@ -8,16 +8,24 @@ require 'test_emailcases'
8
8
  class EmailDiffTest < RUNIT::TestCase
9
9
 
10
10
  include EmailDiffArrayTests
11
- def emailtest(a, b, c)
11
+ def emailtest(a, b, c, d = :tokens)
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_email(diff,888,999)
17
+ #puts "old stripped:"
18
+ #puts diff.strip_a
19
+ #puts "new stripped:"
20
+ #puts diff.strip_b
21
+ if d == :tokens
22
+ result = a.patch_email(diff,888,999)
23
+ else
24
+ result = a.patch_email(diff)
25
+ end
18
26
  #puts "result:"
19
27
  #puts d
20
- assert_equal(c,d)
28
+ assert_equal(c,result)
21
29
  end
22
30
  end
23
31
 
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- - 4
10
- version: 0.3.4.4
8
+ - 5
9
+ version: 0.3.5
11
10
  platform: ruby
12
11
  authors:
13
12
  - Wayne Walter
@@ -36,7 +35,7 @@ cert_chain:
36
35
  nbAv9FEyqLVW8Q==
37
36
  -----END CERTIFICATE-----
38
37
 
39
- date: 2010-06-27 00:00:00 +00:00
38
+ date: 2010-06-28 00:00:00 +00:00
40
39
  default_executable:
41
40
  dependencies: []
42
41
 
metadata.gz.sig CHANGED
Binary file