File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ def current_line
321
321
rescue
322
322
end
323
323
@er_source . seek ( pos )
324
- rescue IOError
324
+ rescue IOError , Errno :: ESPIPE
325
325
pos = -1
326
326
line = -1
327
327
end
Original file line number Diff line number Diff line change @@ -6,10 +6,7 @@ class TestParseText < Test::Unit::TestCase
6
6
class TestInvalid < self
7
7
def test_text_only
8
8
exception = assert_raise ( REXML ::ParseException ) do
9
- parser = REXML ::Parsers ::BaseParser . new ( 'a' )
10
- while parser . has_next?
11
- parser . pull
12
- end
9
+ REXML ::Parsers ::BaseParser . new ( 'a' ) . pull
13
10
end
14
11
15
12
assert_equal ( <<~DETAIL . chomp , exception . to_s )
@@ -21,6 +18,25 @@ def test_text_only
21
18
DETAIL
22
19
end
23
20
21
+ def test_text_only_with_io_pipe
22
+ IO . pipe do |reader , writer |
23
+ writer . write ( 'a' )
24
+ writer . close
25
+
26
+ exception = assert_raise ( REXML ::ParseException ) do
27
+ REXML ::Parsers ::BaseParser . new ( reader ) . pull
28
+ end
29
+
30
+ assert_equal ( <<~DETAIL . chomp , exception . to_s )
31
+ Malformed XML: Content at the start of the document (got 'a')
32
+ Line: -1
33
+ Position: -1
34
+ Last 80 unconsumed characters:
35
+
36
+ DETAIL
37
+ end
38
+ end
39
+
24
40
def test_before_root
25
41
exception = assert_raise ( REXML ::ParseException ) do
26
42
parser = REXML ::Parsers ::BaseParser . new ( 'b<a></a>' )
You can’t perform that action at this time.
0 commit comments