Skip to content

Commit 87e31ad

Browse files
committed
Use File::NULL for portability if possible.
r38341 by nobu from ruby.
1 parent 6e27720 commit 87e31ad

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/test_rdoc_rdoc.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,23 @@ def test_normalized_file_list_not_modified
123123
end
124124

125125
def test_normalized_file_list_non_file_directory
126-
skip '/dev/stdin is not a character special' unless
127-
File.chardev? '/dev/stdin'
126+
dev = defined?(File::NULL) ? File::NULL : '/dev/stdin'
127+
skip "#{dev} is not a character special" unless
128+
File.chardev? dev
128129

129130
files = nil
130131

131132
out, err = verbose_capture_io do
132-
files = @rdoc.normalized_file_list %w[/dev/stdin]
133+
files = @rdoc.normalized_file_list [dev]
133134
end
134135

135136
files = files.map { |file| File.expand_path file }
136137

137138
assert_empty files
138139

139140
assert_empty out
140-
assert_match %r%^rdoc can't parse%, err
141-
assert_match %r%/dev/stdin$%, err
141+
assert_match %r"^rdoc can't parse", err
142+
assert_match %r"#{dev}$", err
142143
end
143144

144145
def test_parse_file

0 commit comments

Comments
 (0)