@@ -107,14 +107,13 @@ def test_generate
107
107
108
108
encoding = Regexp . escape Encoding ::UTF_8 . name
109
109
110
- assert_match %r%<meta charset="#{ encoding } ">% , File . read ( 'index.html' )
111
- assert_match %r%<meta charset="#{ encoding } ">% , File . read ( 'Object.html' )
110
+ assert_match %r%<meta charset="#{ encoding } ">% , File . binread ( 'index.html' )
111
+ assert_match %r%<meta charset="#{ encoding } ">% , File . binread ( 'Object.html' )
112
112
113
- refute_match ( /Ignored/ , File . read ( 'index.html' ) )
114
- summary = File . read ( 'index.html' ) [ %r[<summary.*Klass\. html.*</summary>.*</details>]m ]
113
+ refute_match ( /Ignored/ , File . binread ( 'index.html' ) )
114
+ summary = File . binread ( 'index.html' ) [ %r[<summary.*Klass\. html.*</summary>.*</details>]m ]
115
115
assert_match ( %r[Klass/Inner\. html".*>Inner<] , summary )
116
- omit 'The following line crashes with "invalid byte sequence in US-ASCII" on ci.rvm.jp and some RubyCIs'
117
- klassnav = File . read ( 'Klass.html' ) [ %r[<div class="nav-section">.*<div id="class-metadata">]m ]
116
+ klassnav = File . binread ( 'Klass.html' ) [ %r[<div class="nav-section">.*<div id="class-metadata">]m ]
118
117
assert_match (
119
118
%r[<li>\s *<details open>\s *<summary>\s *<a href=\S +>Heading 1</a>\s *</summary>\s *<ul]m ,
120
119
klassnav
@@ -131,15 +130,15 @@ def test_generate_page
131
130
@g . generate
132
131
assert_file 'outer_rdoc.html'
133
132
assert_file 'outer/inner_rdoc.html'
134
- index = File . read ( 'index.html' )
133
+ index = File . binread ( 'index.html' )
135
134
re = %r[<summary><a href="\. /outer_rdoc\. html">outer</a></summary>.*?</details>]m
136
135
assert_match ( re , index )
137
136
summary = index [ re ]
138
137
assert_match %r[<a href="\. /outer/inner_rdoc.html">inner</a>] , summary
139
138
re = %r[<details open><summary><a href="\. /outer_rdoc\. html">outer</a></summary>.*?</details>]m
140
- assert_match ( re , File . read ( 'outer_rdoc.html' ) )
139
+ assert_match ( re , File . binread ( 'outer_rdoc.html' ) )
141
140
re = %r[<details open><summary><a href="\. \. /outer_rdoc\. html">outer</a></summary>.*?</details>]m
142
- assert_match ( re , File . read ( 'outer/inner_rdoc.html' ) )
141
+ assert_match ( re , File . binread ( 'outer/inner_rdoc.html' ) )
143
142
end
144
143
145
144
def test_generate_dry_run
@@ -276,7 +275,7 @@ def test_generated_filename_with_html_tag
276
275
@g . generate
277
276
278
277
Dir . glob ( "*.html" , base : @tmpdir ) do |html |
279
- File . read ( File . join ( @tmpdir , html ) ) . scan ( /.*should be escaped.*/ ) do |line |
278
+ File . binread ( File . join ( @tmpdir , html ) ) . scan ( /.*should be escaped.*/ ) do |line |
280
279
assert_not_include line , "<em>" , html
281
280
end
282
281
end
@@ -294,23 +293,23 @@ def test_template_stylesheets
294
293
@g . generate
295
294
296
295
assert_file base
297
- assert_include File . read ( 'index.html' ) , %Q[href="./#{ base } "]
296
+ assert_include File . binread ( 'index.html' ) , %Q[href="./#{ base } "]
298
297
end
299
298
300
299
def test_title
301
300
title = "RDoc Test" . freeze
302
301
@options . title = title
303
302
@g . generate
304
303
305
- assert_main_title ( File . read ( 'index.html' ) , title )
304
+ assert_main_title ( File . binread ( 'index.html' ) , title )
306
305
end
307
306
308
307
def test_title_escape
309
308
title = %[<script>alert("RDoc")</script>] . freeze
310
309
@options . title = title
311
310
@g . generate
312
311
313
- assert_main_title ( File . read ( 'index.html' ) , title )
312
+ assert_main_title ( File . binread ( 'index.html' ) , title )
314
313
end
315
314
316
315
##
0 commit comments