docdiff 0.6.2 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +29 -52
- data/README.md +352 -0
- data/README_ja.md +352 -0
- data/Rakefile +2 -42
- data/bin/docdiff +1 -185
- data/{docdiff.conf.example → doc/example/docdiff.conf.example} +4 -3
- data/doc/man/docdiff.adoc +146 -0
- data/doc/news.md +189 -0
- data/doc/shell_completion/_docdiff.zsh +51 -0
- data/doc/shell_completion/docdiff.bash +68 -0
- data/docdiff.gemspec +2 -0
- data/lib/doc_diff.rb +19 -40
- data/lib/docdiff/cli.rb +281 -0
- data/lib/docdiff/version.rb +1 -1
- data/lib/docdiff/view.rb +22 -10
- data/test/charstring_test.rb +121 -121
- data/test/cli_test.rb +312 -0
- data/test/docdiff_test.rb +0 -23
- data/test/document_test.rb +109 -109
- data/test/fixture/01_ja_utf8_lf.txt +2 -0
- data/test/fixture/02_ja_utf8_lf.txt +2 -0
- data/test/fixture/format_wdiff.conf +1 -0
- data/test/fixture/simple.conf +9 -0
- data/test/view_test.rb +135 -111
- metadata +58 -37
- data/devutil/changelog.sh +0 -40
- data/index.html +0 -181
- data/langfilter.rb +0 -10
- data/readme.html +0 -750
- data/readme.md +0 -185
- /data/{docdiffwebui.cgi → doc/example/docdiffwebui.cgi} +0 -0
- /data/{docdiffwebui.html → doc/example/docdiffwebui.html} +0 -0
- /data/{img/docdiff-screenshot-format-html-digest-firefox.png → doc/img/screenshot-format-html-digest-firefox.png} +0 -0
- /data/{img/docdiff-screenshot-format-html-firefox.png → doc/img/screenshot-format-html-firefox.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-cmdexe-en.png → doc/img/screenshot-format-tty-cmdexe-en.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-cmdexe-ja.png → doc/img/screenshot-format-tty-cmdexe-ja.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-rxvtunicode-en.png → doc/img/screenshot-format-tty-rxvtunicode-en.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-rxvtunicode-ja.png → doc/img/screenshot-format-tty-rxvtunicode-ja.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-xterm-en.png → doc/img/screenshot-format-tty-xterm-en.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-xterm-ja.png → doc/img/screenshot-format-tty-xterm-ja.png} +0 -0
- /data/{img/docdiff-screenshot-resolution-linewordchar-xterm.png → doc/img/screenshot-resolution-linewordchar-xterm.png} +0 -0
- /data/{sample/01.en.ascii.cr → test/fixture/01_en_ascii_cr.txt} +0 -0
- /data/{sample/01.en.ascii.crlf → test/fixture/01_en_ascii_crlf.txt} +0 -0
- /data/{sample/01.en.ascii.lf → test/fixture/01_en_ascii_lf.txt} +0 -0
- /data/{sample/01.ja.eucjp.lf → test/fixture/01_ja_eucjp_lf.txt} +0 -0
- /data/{sample/01.ja.sjis.cr → test/fixture/01_ja_sjis_cr.txt} +0 -0
- /data/{sample/01.ja.sjis.crlf → test/fixture/01_ja_sjis_crlf.txt} +0 -0
- /data/{sample/01.ja.utf8.crlf → test/fixture/01_ja_utf8_crlf.txt} +0 -0
- /data/{sample/02.en.ascii.cr → test/fixture/02_en_ascii_cr.txt} +0 -0
- /data/{sample/02.en.ascii.crlf → test/fixture/02_en_ascii_crlf.txt} +0 -0
- /data/{sample/02.en.ascii.lf → test/fixture/02_en_ascii_lf.txt} +0 -0
- /data/{sample/02.ja.eucjp.lf → test/fixture/02_ja_eucjp_lf.txt} +0 -0
- /data/{sample/02.ja.sjis.cr → test/fixture/02_ja_sjis_cr.txt} +0 -0
- /data/{sample/02.ja.sjis.crlf → test/fixture/02_ja_sjis_crlf.txt} +0 -0
- /data/{sample/02.ja.utf8.crlf → test/fixture/02_ja_utf8_crlf.txt} +0 -0
- /data/{sample/humpty_dumpty01.ascii.lf → test/fixture/humpty_dumpty01_ascii_lf.txt} +0 -0
- /data/{sample/humpty_dumpty02.ascii.lf → test/fixture/humpty_dumpty02_ascii_lf.txt} +0 -0
data/test/cli_test.rb
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
# -*- coding: utf-8; -*-
|
|
3
|
+
|
|
4
|
+
require 'test/unit'
|
|
5
|
+
require 'nkf'
|
|
6
|
+
require 'docdiff/cli'
|
|
7
|
+
|
|
8
|
+
class TC_CLI < Test::Unit::TestCase
|
|
9
|
+
def test_parse_options!()
|
|
10
|
+
args = [
|
|
11
|
+
"--resolution=line",
|
|
12
|
+
"--char",
|
|
13
|
+
"--encoding=ASCII",
|
|
14
|
+
"--eucjp",
|
|
15
|
+
"--eol=CR",
|
|
16
|
+
"--crlf",
|
|
17
|
+
"--format=manued",
|
|
18
|
+
"--wdiff",
|
|
19
|
+
"--label=old",
|
|
20
|
+
"--label=new",
|
|
21
|
+
"--digest",
|
|
22
|
+
"--display=block",
|
|
23
|
+
"--pager='less --raw-control-chars'",
|
|
24
|
+
"--no-config-file",
|
|
25
|
+
"--config-file=./docdiff.conf",
|
|
26
|
+
"file1",
|
|
27
|
+
"file2",
|
|
28
|
+
]
|
|
29
|
+
expected = {
|
|
30
|
+
:resolution => "char",
|
|
31
|
+
:encoding => "EUC-JP",
|
|
32
|
+
:eol => "CRLF",
|
|
33
|
+
:format => "wdiff",
|
|
34
|
+
:digest => true,
|
|
35
|
+
:label => ["old", "new"],
|
|
36
|
+
:display => "block",
|
|
37
|
+
:pager => "'less --raw-control-chars'",
|
|
38
|
+
:no_config_file => true,
|
|
39
|
+
:config_file => "./docdiff.conf",
|
|
40
|
+
}
|
|
41
|
+
assert_equal(expected, DocDiff::CLI.parse_options!(args, base_options: {}))
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_parse_config_file_content()
|
|
45
|
+
content = ["# comment line\n",
|
|
46
|
+
" # comment line with leading space\n",
|
|
47
|
+
"foo1 = bar\n",
|
|
48
|
+
"foo2 = bar baz \n",
|
|
49
|
+
" foo3 = 123 # comment\n",
|
|
50
|
+
"foo4 = no \n",
|
|
51
|
+
"foo1 = tRue\n",
|
|
52
|
+
"\n",
|
|
53
|
+
"",
|
|
54
|
+
nil].join
|
|
55
|
+
expected = {:foo1=>true, :foo2=>"bar baz", :foo3=>123, :foo4=>false}
|
|
56
|
+
assert_equal(expected, DocDiff::CLI.parse_config_file_content(content))
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def test_read_config_from_file()
|
|
60
|
+
filename = File.join(File.dirname(__FILE__), "fixture/simple.conf")
|
|
61
|
+
expected = {:foo1 => true, :foo2 => "bar baz", :foo3 => 123, :foo4 => false}
|
|
62
|
+
config, _message = DocDiff::CLI.read_config_from_file(filename)
|
|
63
|
+
assert_equal(expected, config)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_read_config_from_file_raises_exception()
|
|
67
|
+
assert_raise(Errno::ENOENT) do
|
|
68
|
+
config, message = DocDiff::CLI.read_config_from_file("no/such/file")
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_cli_resolution_line()
|
|
73
|
+
expected = <<~EOS.chomp
|
|
74
|
+
[-Hello, my name is Watanabe.
|
|
75
|
+
I am just another Ruby porter.
|
|
76
|
+
-]{+Hello, my name is matz.
|
|
77
|
+
It's me who has created Ruby. I am a Ruby hacker.
|
|
78
|
+
+}
|
|
79
|
+
EOS
|
|
80
|
+
cmd = "ruby -I lib bin/docdiff --resolution=line --format=wdiff" +
|
|
81
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
82
|
+
actual = `#{cmd}`
|
|
83
|
+
assert_equal(expected, actual)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_cli_resolution_word()
|
|
87
|
+
expected = <<~EOS
|
|
88
|
+
Hello, my name is [-Watanabe.-]{+matz.+}
|
|
89
|
+
{+It's me who has created Ruby. +}I am [-just another -]{+a +}Ruby [-porter.-]{+hacker.+}
|
|
90
|
+
EOS
|
|
91
|
+
cmd = "ruby -I lib bin/docdiff --resolution=word --format=wdiff" +
|
|
92
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
93
|
+
actual = `#{cmd}`
|
|
94
|
+
assert_equal(expected, actual)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def test_cli_resolution_char()
|
|
98
|
+
expected = <<~EOS
|
|
99
|
+
Hello, my name is [-W-]{+m+}at[-anabe-]{+z+}.
|
|
100
|
+
{+It's me who has created Ruby. +}I am [-just -]a[-nother-] Ruby [-port-]{+hack+}er.
|
|
101
|
+
EOS
|
|
102
|
+
cmd = "ruby -I lib bin/docdiff --resolution=char --format=wdiff" +
|
|
103
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
104
|
+
actual = `#{cmd}`
|
|
105
|
+
assert_equal(expected, actual)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def test_cli_encoding_ascii()
|
|
109
|
+
expected = <<~EOS
|
|
110
|
+
Hello, my name is [-Watanabe.-]{+matz.+}
|
|
111
|
+
{+It's me who has created Ruby. +}I am [-just another -]{+a +}Ruby [-porter.-]{+hacker.+}
|
|
112
|
+
EOS
|
|
113
|
+
cmd = "ruby -I lib bin/docdiff --encoding=ASCII --format=wdiff" +
|
|
114
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
115
|
+
actual = `#{cmd}`
|
|
116
|
+
assert_equal(expected, actual)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def test_cli_encoding_euc_jp()
|
|
120
|
+
expected = NKF.nkf("--ic=UTF-8 --oc=EUC-JP", <<~EOS)
|
|
121
|
+
[-こんにちは-]{+こんばんは+}、私の[-名前はわたなべです-]{+名前はまつもとです+}。
|
|
122
|
+
{+Rubyを作ったのは私です。+}私は[-Just Another -]Ruby [-Porter-]{+Hacker+}です。
|
|
123
|
+
EOS
|
|
124
|
+
cmd = "ruby --external-encoding EUC-JP -I lib bin/docdiff --encoding=EUC-JP --format=wdiff" +
|
|
125
|
+
" test/fixture/01_ja_eucjp_lf.txt test/fixture/02_ja_eucjp_lf.txt"
|
|
126
|
+
actual = `#{cmd}`.force_encoding("EUC-JP")
|
|
127
|
+
assert_equal(expected, actual)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def test_cli_encoding_shift_jis()
|
|
131
|
+
expected_utf8_cr =
|
|
132
|
+
"[-こんにちは-]{+こんばんは+}、私の[-名前はわたなべです-]{+名前はまつもとです+}。\r" +
|
|
133
|
+
"{+Rubyを作ったのは私です。+}私は[-Just Another -]Ruby [-Porter-]{+Hacker+}です。\r"
|
|
134
|
+
expected = NKF.nkf("--ic=UTF-8 --oc=Shift_JIS", expected_utf8_cr)
|
|
135
|
+
cmd = "ruby --external-encoding Shift_JIS -I lib bin/docdiff --encoding=Shift_JIS --format=wdiff" +
|
|
136
|
+
" test/fixture/01_ja_sjis_cr.txt test/fixture/02_ja_sjis_cr.txt"
|
|
137
|
+
actual = `#{cmd}`.force_encoding("Shift_JIS")
|
|
138
|
+
assert_equal(expected, actual)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def test_cli_encoding_utf_8()
|
|
142
|
+
expected = <<~EOS
|
|
143
|
+
[-こんにちは-]{+こんばんは+}、私の[-名前はわたなべです-]{+名前はまつもとです+}。
|
|
144
|
+
{+Rubyを作ったのは私です。+}私は[-Just Another -]Ruby [-Porter-]{+Hacker+}です。
|
|
145
|
+
EOS
|
|
146
|
+
cmd = "ruby -I lib bin/docdiff --encoding=UTF-8 --format=wdiff" +
|
|
147
|
+
" test/fixture/01_ja_utf8_lf.txt test/fixture/02_ja_utf8_lf.txt"
|
|
148
|
+
actual = `#{cmd}`.force_encoding("UTF-8")
|
|
149
|
+
assert_equal(expected, actual)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def test_cli_eol_cr()
|
|
153
|
+
expected =
|
|
154
|
+
"Hello, my name is [-Watanabe.-]{+matz.+}\r" +
|
|
155
|
+
"{+It's me who has created Ruby. +}I am [-just another -]{+a +}Ruby [-porter.-]{+hacker.+}\r"
|
|
156
|
+
cmd = "ruby -I lib bin/docdiff --eol=CR --format=wdiff" +
|
|
157
|
+
" test/fixture/01_en_ascii_cr.txt test/fixture/02_en_ascii_cr.txt"
|
|
158
|
+
actual = `#{cmd}`
|
|
159
|
+
assert_equal(expected, actual)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def test_cli_eol_lf()
|
|
163
|
+
expected =
|
|
164
|
+
"Hello, my name is [-Watanabe.-]{+matz.+}\n" +
|
|
165
|
+
"{+It's me who has created Ruby. +}I am [-just another -]{+a +}Ruby [-porter.-]{+hacker.+}\n"
|
|
166
|
+
cmd = "ruby -I lib bin/docdiff --eol=LF --format=wdiff" +
|
|
167
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
168
|
+
actual = `#{cmd}`
|
|
169
|
+
assert_equal(expected, actual)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def test_cli_eol_crlf()
|
|
173
|
+
expected =
|
|
174
|
+
"Hello, my name is [-Watanabe.-]{+matz.+}\r\n" +
|
|
175
|
+
"{+It's me who has created Ruby. +}I am [-just another -]{+a +}Ruby [-porter.-]{+hacker.+}\r\n"
|
|
176
|
+
cmd = "ruby -I lib bin/docdiff --eol=CRLF --format=wdiff" +
|
|
177
|
+
" test/fixture/01_en_ascii_crlf.txt test/fixture/02_en_ascii_crlf.txt"
|
|
178
|
+
actual = `#{cmd}`
|
|
179
|
+
assert_equal(expected, actual)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def test_cli_format_html()
|
|
183
|
+
expected = <<~EOS
|
|
184
|
+
<span class="common">Hello, my name is </span>\
|
|
185
|
+
<span class="before-change"><del>Watanabe.</del></span>\
|
|
186
|
+
<span class="after-change"><ins>matz.</ins></span>\
|
|
187
|
+
<span class="common"><br />
|
|
188
|
+
EOS
|
|
189
|
+
cmd = "ruby -I lib bin/docdiff --format=html" +
|
|
190
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
191
|
+
actual = `#{cmd}`.scan(/^.*?$\n/m)[-4]
|
|
192
|
+
assert_equal(expected, actual)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def test_cli_format_manued()
|
|
196
|
+
expected = "Hello, my name is [Watanabe./matz.]\n"
|
|
197
|
+
cmd = "ruby -I lib bin/docdiff --format=manued" +
|
|
198
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
199
|
+
actual = `#{cmd}`.scan(/^.*?$\n/m)[-2]
|
|
200
|
+
assert_equal(expected, actual)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def test_cli_format_tty()
|
|
204
|
+
expected = "Hello, my name is \e[7;4;33mWatanabe.\e[0m\e[7;1;32mmatz.\e[0m\n"
|
|
205
|
+
cmd = "ruby -I lib bin/docdiff --format=tty" +
|
|
206
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
207
|
+
actual = `#{cmd}`.scan(/^.*?$\n/m).first
|
|
208
|
+
assert_equal(expected, actual)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def test_cli_format_wdiff()
|
|
212
|
+
expected = "Hello, my name is [-Watanabe.-]{+matz.+}\n"
|
|
213
|
+
cmd = "ruby -I lib bin/docdiff --format=wdiff" +
|
|
214
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
215
|
+
actual = `#{cmd}`.scan(/^.*?$\n/m).first
|
|
216
|
+
assert_equal(expected, actual)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def test_cli_digest()
|
|
220
|
+
expected = <<~EOS
|
|
221
|
+
----
|
|
222
|
+
1,1
|
|
223
|
+
Hello, my name is [-Watanabe.-]{+matz.+}
|
|
224
|
+
|
|
225
|
+
----
|
|
226
|
+
(2),2
|
|
227
|
+
|
|
228
|
+
{+It's me who has created Ruby. +}I am
|
|
229
|
+
----
|
|
230
|
+
2,2
|
|
231
|
+
I am [-just another -]{+a +}Ruby
|
|
232
|
+
----
|
|
233
|
+
2,2
|
|
234
|
+
Ruby [-porter.-]{+hacker.+}
|
|
235
|
+
|
|
236
|
+
----
|
|
237
|
+
EOS
|
|
238
|
+
cmd = "ruby -I lib bin/docdiff --digest --format=wdiff" +
|
|
239
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
240
|
+
actual = `#{cmd}`.force_encoding("UTF-8")
|
|
241
|
+
assert_equal(expected, actual)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def test_cli_display_inline()
|
|
245
|
+
expected = <<~EOS
|
|
246
|
+
----
|
|
247
|
+
1,1
|
|
248
|
+
Hello, my name is [-Watanabe.-]{+matz.+}
|
|
249
|
+
|
|
250
|
+
----
|
|
251
|
+
(2),2
|
|
252
|
+
|
|
253
|
+
{+It's me who has created Ruby. +}I am
|
|
254
|
+
----
|
|
255
|
+
2,2
|
|
256
|
+
I am [-just another -]{+a +}Ruby
|
|
257
|
+
----
|
|
258
|
+
2,2
|
|
259
|
+
Ruby [-porter.-]{+hacker.+}
|
|
260
|
+
|
|
261
|
+
----
|
|
262
|
+
EOS
|
|
263
|
+
cmd = "ruby -I lib bin/docdiff --digest --display=inline --format=wdiff" +
|
|
264
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
265
|
+
actual = `#{cmd}`.force_encoding("UTF-8")
|
|
266
|
+
assert_equal(expected, actual)
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def test_cli_display_block()
|
|
270
|
+
expected = <<~EOS
|
|
271
|
+
----
|
|
272
|
+
1,1
|
|
273
|
+
Hello, my name is [-Watanabe.-]
|
|
274
|
+
|
|
275
|
+
Hello, my name is {+matz.+}
|
|
276
|
+
|
|
277
|
+
----
|
|
278
|
+
(2),2
|
|
279
|
+
|
|
280
|
+
I am
|
|
281
|
+
|
|
282
|
+
{+It's me who has created Ruby. +}I am
|
|
283
|
+
----
|
|
284
|
+
2,2
|
|
285
|
+
I am [-just another -]Ruby
|
|
286
|
+
I am {+a +}Ruby
|
|
287
|
+
----
|
|
288
|
+
2,2
|
|
289
|
+
Ruby [-porter.-]
|
|
290
|
+
|
|
291
|
+
Ruby {+hacker.+}
|
|
292
|
+
|
|
293
|
+
----
|
|
294
|
+
EOS
|
|
295
|
+
cmd = "ruby -I lib bin/docdiff --digest --display=block --format=wdiff" +
|
|
296
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
297
|
+
actual = `#{cmd}`.force_encoding("UTF-8")
|
|
298
|
+
assert_equal(expected, actual)
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def test_cli_config_file_format_wdiff()
|
|
302
|
+
config_file_name = File.join(File.dirname(__FILE__), "fixture/format_wdiff.conf")
|
|
303
|
+
expected = <<~EOS
|
|
304
|
+
Hello, my name is [-Watanabe.-]{+matz.+}
|
|
305
|
+
{+It's me who has created Ruby. +}I am [-just another -]{+a +}Ruby [-porter.-]{+hacker.+}
|
|
306
|
+
EOS
|
|
307
|
+
cmd = "ruby -I lib bin/docdiff --config-file=#{config_file_name}" +
|
|
308
|
+
" test/fixture/01_en_ascii_lf.txt test/fixture/02_en_ascii_lf.txt"
|
|
309
|
+
actual = `#{cmd}`
|
|
310
|
+
assert_equal(expected, actual)
|
|
311
|
+
end
|
|
312
|
+
end
|
data/test/docdiff_test.rb
CHANGED
|
@@ -117,22 +117,6 @@ class TC_DocDiff < Test::Unit::TestCase
|
|
|
117
117
|
assert_equal(expected, docdiff.run(doc1, doc2, {:resolution => "char", :format => "manued", :digest => false}))
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
def test_parse_config_file_content()
|
|
121
|
-
content = ["# comment line\n",
|
|
122
|
-
" # comment line with leading space\n",
|
|
123
|
-
"foo1 = bar\n",
|
|
124
|
-
"foo2 = bar baz \n",
|
|
125
|
-
" foo3 = 123 # comment\n",
|
|
126
|
-
"foo4 = no \n",
|
|
127
|
-
"foo1 = tRue\n",
|
|
128
|
-
"\n",
|
|
129
|
-
"",
|
|
130
|
-
nil].join
|
|
131
|
-
expected = {:foo1=>true, :foo2=>"bar baz", :foo3=>123, :foo4=>false}
|
|
132
|
-
assert_equal(expected,
|
|
133
|
-
DocDiff.parse_config_file_content(content))
|
|
134
|
-
end
|
|
135
|
-
|
|
136
120
|
def test_run_line_user()
|
|
137
121
|
doc1 = Document.new("foo bar\nbaz", 'US-ASCII', 'LF')
|
|
138
122
|
doc2 = Document.new("foo beer\nbaz", 'US-ASCII', 'LF')
|
|
@@ -187,13 +171,6 @@ class TC_DocDiff < Test::Unit::TestCase
|
|
|
187
171
|
expected = "<=>foo </=><=>b</=><!->a</!-><!+>ee</!+><=>r</=><=>\n</=><=>baz</=>"
|
|
188
172
|
assert_equal(expected, docdiff.run(doc1, doc2, {:resolution => "char", :format => "user", :digest => false}))
|
|
189
173
|
end
|
|
190
|
-
def test_cli()
|
|
191
|
-
expected = "Hello, my name is [-Watanabe.-]{+matz.+}\n"
|
|
192
|
-
cmd = "ruby -I lib bin/docdiff --wdiff" +
|
|
193
|
-
" sample/01.en.ascii.lf sample/02.en.ascii.lf"
|
|
194
|
-
actual = `#{cmd}`.scan(/^.*?$\n/m).first
|
|
195
|
-
assert_equal(expected, actual)
|
|
196
|
-
end
|
|
197
174
|
|
|
198
175
|
def teardown()
|
|
199
176
|
#
|