1BEGIN{ $ENV{STRING_DIFF_PP} = 1; }
2use strict;
3use utf8;
4use Test::Base;
5
6use String::Diff qw( diff_fully );
7
8filters { data1 => [qw/ yaml /], data2 => [qw/ yaml string_diff /] };
9
10sub string_diff {
11    my $input = shift;
12    my $diff = diff_fully($input->{old}, $input->{new}, %{ $input->{options} });
13    $diff;
14}
15
16run_compare;
17
18__END__
19
20===
21--- data1
22- []
23-
24 - ['+', 'perl']
25--- data2
26old:
27new: perl
28
29===
30--- data1
31-
32 - ['-', 'perl']
33-
34--- data2
35old: perl
36new:
37
38===
39--- data1
40- []
41- []
42--- data2
43old:
44new:
45
46===
47--- data1
48-
49  - ['u', 'pe']
50  - ['u', 'rl']
51-
52  - ['u', 'pe']
53  - ['+', 'a']
54  - ['u', 'rl']
55--- data2
56old: perl
57new: pearl
58
59===
60--- data1
61-
62  - ['u', 'th']
63  - ['-', 'i']
64  - ['u', 's ']
65  - ['-', 'is ']
66  - ['u', 'a']
67  - ['-', ' pen']
68-
69  - ['u', 'th']
70  - ['+', "at'"]
71  - ['u', 's ']
72  - ['u', 'a']
73  - ['+', 'll']
74--- data2
75old: this is a pen
76new: "that's all"
77
78===
79--- data1
80-
81  - ['-', 'S']
82  - ['u', 'oo']
83  - ['-', 'z']
84  - ['u', 'y']
85-
86  - ['+', 'B']
87  - ['u', 'oo']
88  - ['+', 'f']
89  - ['u', 'y']
90--- data2
91old: Soozy
92new: Boofy
93
94===
95--- data1
96-
97  - ['-', 'あ']
98  - ['u', 'る']
99  - ['-', '晴れた日に散歩をすると']
100  - ['u', '、そ']
101  - ['-', 'こに']
102  - ['u', 'は']
103-
104  - ['+', 'いつもい']
105  - ['u', 'る']
106  - ['+', '人がいないので']
107  - ['u', '、そ']
108  - ['+', 'れ']
109  - ['u', 'は']
110--- data2
111old: ある晴れた日に散歩をすると、そこには
112new: いつもいる人がいないので、それは
113
114===
115--- data1
116-
117  - ['u', 'This library is ']
118  - ['-', 'free software']
119  - ['u', '; you can ']
120  - ['u', 'redistribute it ']
121  - ['u', 'and']
122  - ['-', '/or']
123  - ['u', " modify\nit under the same terms as Pe"]
124  - ['u', 'rl it']
125  - ['u', 'self.']
126-
127  - ['u', 'This library is ']
128  - ['+', '自由なソフト']
129  - ['u', '; you can ']
130  - ['+', 'not ']
131  - ['u', 'redistribute it ']
132  - ['+', 'or/']
133  - ['u', 'and']
134  - ['u', " modify\nit under the same terms as Pe"]
135  - ['+', 'a']
136  - ['u', 'rl it']
137  - ['+', ' ']
138  - ['u', 'self.']
139--- data2
140old: |-
141  This library is free software; you can redistribute it and/or modify
142  it under the same terms as Perl itself.
143new: |-
144  This library is 自由なソフト; you can not redistribute it or/and modify
145  it under the same terms as Pearl it self.
146
147===
148--- data1
149-
150  - ['u', 'This library is ']
151  - ['-', 'free software']
152  - ['u', '; you can ']
153  - ['u', 'redistribute it ']
154  - ['u', 'and']
155  - ['-', '/or']
156  - ['u', ' modify']
157  - ['-', "\n"]
158  - ['u', 'it under the same terms as Pe']
159  - ['u', 'rl it']
160  - ['u', 'self.']
161-
162  - ['u', 'This library is ']
163  - ['+', '自由なソフト']
164  - ['u', '; you can ']
165  - ['+', 'not ']
166  - ['u', 'redistribute it ']
167  - ['+', 'or/']
168  - ['u', 'and']
169  - ['u', ' modify']
170  - ['+', " "]
171  - ['u', 'it under the same terms as Pe']
172  - ['+', 'a']
173  - ['u', 'rl it']
174  - ['+', ' ']
175  - ['u', 'self.']
176--- data2
177old: |-
178  This library is free software; you can redistribute it and/or modify
179  it under the same terms as Perl itself.
180new: This library is 自由なソフト; you can not redistribute it or/and modify it under the same terms as Pearl it self.
181
182===
183--- data1
184-
185  - ['-', "remove\n"]
186  - ['u', 'This library is ']
187  - ['-', 'free software']
188  - ['u', '; you can ']
189  - ['u', 'redistribute it ']
190  - ['u', 'and']
191  - ['-', '/or']
192  - ['u', " modify\n(snip)\nit under the same terms as Pe"]
193  - ['u', 'rl it']
194  - ['u', 'self.']
195-
196  - ['u', 'This library is ']
197  - ['+', '自由なソフト']
198  - ['u', '; you can ']
199  - ['+', 'not ']
200  - ['u', 'redistribute it ']
201  - ['+', 'or/']
202  - ['u', 'and']
203  - ['u', " modify\n(snip)\nit under the same terms as Pe"]
204  - ['+', 'a']
205  - ['u', 'rl it']
206  - ['+', ' ']
207  - ['u', 'self.']
208  - ['+', "\nappend"]
209--- data2
210old: |-
211  remove
212  This library is free software; you can redistribute it and/or modify
213  (snip)
214  it under the same terms as Perl itself.
215new: |-
216  This library is 自由なソフト; you can not redistribute it or/and modify
217  (snip)
218  it under the same terms as Pearl it self.
219  append
220
221===
222--- data1
223-
224  - ['u', 'This library is ']
225  - ['-', 'free software']
226  - ['u', '; you can ']
227  - ['u', 'redistribute it ']
228  - ['u', 'and']
229  - ['-', '/or']
230  - ['u', ' modify']
231  - ['u', "\n"]
232  - ['u', 'it under the same terms as Pe']
233  - ['u', 'rl it']
234  - ['u', 'self.']
235-
236  - ['u', 'This library is ']
237  - ['+', '自由なソフト']
238  - ['u', '; you can ']
239  - ['+', 'not ']
240  - ['u', 'redistribute it ']
241  - ['+', 'or/']
242  - ['u', 'and']
243  - ['u', ' modify']
244  - ['u', "\n"]
245  - ['u', 'it under the same terms as Pe']
246  - ['+', 'a']
247  - ['u', 'rl it']
248  - ['+', ' ']
249  - ['u', 'self.']
250--- data2
251old: |-
252  This library is free software; you can redistribute it and/or modify
253  it under the same terms as Perl itself.
254new: |-
255  This library is 自由なソフト; you can not redistribute it or/and modify
256  it under the same terms as Pearl it self.
257options:
258  linebreak: 1
259
260===
261--- data1
262-
263  - ['u', 'r']
264  - ['u', 'e']
265  - ['u', 'mo']
266  - ['-', 've']
267  - ['u', "\n"]
268  - ['-', 'This library is free software; you can redistribute it and/or modify']
269  - ['-', "\n"]
270  - ['u', '(snip)']
271  - ['u', "\n"]
272  - ['u', 'it under the same terms as Pe']
273  - ['u', 'rl it']
274  - ['u', 'self.']
275-
276  - ['+', 'This lib']
277  - ['u', 'r']
278  - ['+', 'ary is 自由なソフト; you can not r']
279  - ['u', 'e']
280  - ['+', 'distribute it or/and ']
281  - ['u', 'mo']
282  - ['+', 'dify']
283  - ['u', "\n"]
284  - ['u', '(snip)']
285  - ['u', "\n"]
286  - ['u', 'it under the same terms as Pe']
287  - ['+', 'a']
288  - ['u', 'rl it']
289  - ['+', ' ']
290  - ['u', 'self.']
291  - ['+', "\n"]
292  - ['+', 'append']
293--- data2
294old: |-
295  remove
296  This library is free software; you can redistribute it and/or modify
297  (snip)
298  it under the same terms as Perl itself.
299new: |-
300  This library is 自由なソフト; you can not redistribute it or/and modify
301  (snip)
302  it under the same terms as Pearl it self.
303  append
304options:
305  linebreak: 1
306
307===
308--- data1
309-
310  - ['u', '1']
311  - ['-', '0']
312-
313  - ['u', '1']
314  - ['+', '1']
315--- data2
316old: 10
317new: 11
318
319