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 +0 -0
- data/Rakefile +1 -1
- data/diff.gemspec +1 -1
- data/lib/emaildiff.rb +4 -4
- data/test/test_emailcases.rb +26 -25
- data/test/test_emaildiff.rb +3 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
data/diff.gemspec
CHANGED
data/lib/emaildiff.rb
CHANGED
@@ -44,7 +44,7 @@ module HTMLCollapsable
|
|
44
44
|
Diff.new(self, b)
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
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.
|
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.
|
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.
|
96
|
+
newary << diff.orig_b[bi]
|
97
97
|
ai += 1
|
98
98
|
bi += 1
|
99
99
|
end
|
data/test/test_emailcases.rb
CHANGED
@@ -1,68 +1,69 @@
|
|
1
|
-
module
|
1
|
+
module EmailDiffArrayTests
|
2
|
+
|
2
3
|
def test_array_quoted
|
3
|
-
|
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
6
|
end
|
6
7
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
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
|
-
|
14
|
-
|
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
|
-
|
19
|
-
|
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
|
-
|
24
|
-
|
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
|
-
|
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
|
-
|
34
|
-
|
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
|
-
|
39
|
-
|
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
|
-
|
44
|
+
emailtest [1,2,3], [], []
|
44
45
|
end
|
45
46
|
|
46
47
|
def test_array_fill
|
47
|
-
|
48
|
+
emailtest [], [1,2,3], [1,2,3]
|
48
49
|
end
|
49
50
|
|
50
51
|
def test_array_change
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
data/test/test_emaildiff.rb
CHANGED
@@ -7,14 +7,14 @@ require 'test_emailcases'
|
|
7
7
|
|
8
8
|
class EmailDiffTest < RUNIT::TestCase
|
9
9
|
|
10
|
-
include
|
11
|
-
def
|
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.
|
17
|
+
d = a.patch_email(diff,888,999)
|
18
18
|
#puts "result:"
|
19
19
|
#puts d
|
20
20
|
assert_equal(c,d)
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|