39 # Basic usage |
43 # Basic usage |
40 |
44 |
41 oldann = decorate(olddata, oldfctx) |
45 oldann = decorate(olddata, oldfctx) |
42 p1ann = decorate(p1data, p1fctx) |
46 p1ann = decorate(p1data, p1fctx) |
43 p1ann = _annotatepair([oldann], p1fctx, p1ann, False, diffopts) |
47 p1ann = _annotatepair([oldann], p1fctx, p1ann, False, diffopts) |
44 self.assertEqual(tr(p1ann), [ |
48 self.assertEqual( |
45 annotateline(b'old', 1), |
49 tr(p1ann), |
46 annotateline(b'old', 2), |
50 [ |
47 annotateline(b'p1', 3), |
51 annotateline(b'old', 1), |
48 ]) |
52 annotateline(b'old', 2), |
|
53 annotateline(b'p1', 3), |
|
54 ], |
|
55 ) |
49 |
56 |
50 p2ann = decorate(p2data, p2fctx) |
57 p2ann = decorate(p2data, p2fctx) |
51 p2ann = _annotatepair([oldann], p2fctx, p2ann, False, diffopts) |
58 p2ann = _annotatepair([oldann], p2fctx, p2ann, False, diffopts) |
52 self.assertEqual(tr(p2ann), [ |
59 self.assertEqual( |
53 annotateline(b'old', 1), |
60 tr(p2ann), |
54 annotateline(b'p2', 2), |
61 [ |
55 annotateline(b'p2', 3), |
62 annotateline(b'old', 1), |
56 ]) |
63 annotateline(b'p2', 2), |
|
64 annotateline(b'p2', 3), |
|
65 ], |
|
66 ) |
57 |
67 |
58 # Test with multiple parents (note the difference caused by ordering) |
68 # Test with multiple parents (note the difference caused by ordering) |
59 |
69 |
60 childann = decorate(childdata, childfctx) |
70 childann = decorate(childdata, childfctx) |
61 childann = _annotatepair([p1ann, p2ann], childfctx, childann, False, |
71 childann = _annotatepair( |
62 diffopts) |
72 [p1ann, p2ann], childfctx, childann, False, diffopts |
63 self.assertEqual(tr(childann), [ |
73 ) |
64 annotateline(b'old', 1), |
74 self.assertEqual( |
65 annotateline(b'c', 2), |
75 tr(childann), |
66 annotateline(b'p2', 2), |
76 [ |
67 annotateline(b'c', 4), |
77 annotateline(b'old', 1), |
68 annotateline(b'p2', 3), |
78 annotateline(b'c', 2), |
69 ]) |
79 annotateline(b'p2', 2), |
|
80 annotateline(b'c', 4), |
|
81 annotateline(b'p2', 3), |
|
82 ], |
|
83 ) |
70 |
84 |
71 childann = decorate(childdata, childfctx) |
85 childann = decorate(childdata, childfctx) |
72 childann = _annotatepair([p2ann, p1ann], childfctx, childann, False, |
86 childann = _annotatepair( |
73 diffopts) |
87 [p2ann, p1ann], childfctx, childann, False, diffopts |
74 self.assertEqual(tr(childann), [ |
88 ) |
75 annotateline(b'old', 1), |
89 self.assertEqual( |
76 annotateline(b'c', 2), |
90 tr(childann), |
77 annotateline(b'p1', 3), |
91 [ |
78 annotateline(b'c', 4), |
92 annotateline(b'old', 1), |
79 annotateline(b'p2', 3), |
93 annotateline(b'c', 2), |
80 ]) |
94 annotateline(b'p1', 3), |
|
95 annotateline(b'c', 4), |
|
96 annotateline(b'p2', 3), |
|
97 ], |
|
98 ) |
81 |
99 |
82 # Test with skipchild (note the difference caused by ordering) |
100 # Test with skipchild (note the difference caused by ordering) |
83 |
101 |
84 childann = decorate(childdata, childfctx) |
102 childann = decorate(childdata, childfctx) |
85 childann = _annotatepair([p1ann, p2ann], childfctx, childann, True, |
103 childann = _annotatepair( |
86 diffopts) |
104 [p1ann, p2ann], childfctx, childann, True, diffopts |
87 self.assertEqual(tr(childann), [ |
105 ) |
88 annotateline(b'old', 1), |
106 self.assertEqual( |
89 annotateline(b'old', 2, True), |
107 tr(childann), |
90 # note that this line was carried over from earlier so it is *not* |
108 [ |
91 # marked skipped |
109 annotateline(b'old', 1), |
92 annotateline(b'p2', 2), |
110 annotateline(b'old', 2, True), |
93 annotateline(b'p2', 2, True), |
111 # note that this line was carried over from earlier so it is *not* |
94 annotateline(b'p2', 3), |
112 # marked skipped |
95 ]) |
113 annotateline(b'p2', 2), |
|
114 annotateline(b'p2', 2, True), |
|
115 annotateline(b'p2', 3), |
|
116 ], |
|
117 ) |
96 |
118 |
97 childann = decorate(childdata, childfctx) |
119 childann = decorate(childdata, childfctx) |
98 childann = _annotatepair([p2ann, p1ann], childfctx, childann, True, |
120 childann = _annotatepair( |
99 diffopts) |
121 [p2ann, p1ann], childfctx, childann, True, diffopts |
100 self.assertEqual(tr(childann), [ |
122 ) |
101 annotateline(b'old', 1), |
123 self.assertEqual( |
102 annotateline(b'old', 2, True), |
124 tr(childann), |
103 annotateline(b'p1', 3), |
125 [ |
104 annotateline(b'p1', 3, True), |
126 annotateline(b'old', 1), |
105 annotateline(b'p2', 3), |
127 annotateline(b'old', 2, True), |
106 ]) |
128 annotateline(b'p1', 3), |
|
129 annotateline(b'p1', 3, True), |
|
130 annotateline(b'p2', 3), |
|
131 ], |
|
132 ) |
|
133 |
107 |
134 |
108 if __name__ == '__main__': |
135 if __name__ == '__main__': |
109 import silenttestrunner |
136 import silenttestrunner |
|
137 |
110 silenttestrunner.main(__name__) |
138 silenttestrunner.main(__name__) |