blob: 91fbe35f85f61f24363198e03162ae1978d2c36f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
require 'tempfile'
require 'rubygems'
require 'minitest/autorun'
require 'rdoc/rdoc'
class TestRDocRDoc < MiniTest::Unit::TestCase
def setup
@rdoc = RDoc::RDoc.new
@tempfile = Tempfile.new 'test_rdoc_rdoc'
end
def teardown
@tempfile.close
end
def test_gather_files
assert_equal(%w[lib/rdoc.rb],
@rdoc.gather_files(%w[lib/rdoc.rb lib/rdoc.rb]))
end
def test_read_file_contents
@tempfile.write "hi everybody"
@tempfile.flush
assert_equal "hi everybody", @rdoc.read_file_contents(@tempfile.path)
end
def test_read_file_contents_encoding
skip "Encoding not implemented" unless defined? ::Encoding
@tempfile.write "# coding: utf-8\nhi everybody"
@tempfile.flush
contents = @rdoc.read_file_contents @tempfile.path
assert_equal "# coding: utf-8\nhi everybody", contents
assert_equal Encoding::UTF_8, contents.encoding
end
def test_read_file_contents_encoding_fancy
skip "Encoding not implemented" unless defined? ::Encoding
@tempfile.write "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody"
@tempfile.flush
contents = @rdoc.read_file_contents @tempfile.path
assert_equal("# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody",
contents)
assert_equal Encoding::UTF_8, contents.encoding
end
def test_remove_unparsable
file_list = %w[
blah.class
blah.eps
blah.erb
blah.scpt.txt
blah.ttf
blah.yml
]
assert_empty @rdoc.remove_unparseable file_list
end
end
|