File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555 @read . read_nonblock ( 4 ) . should == "hell"
5656 end
5757
58- platform_is_not :windows do # https://bugs.ruby-lang.org/issues/18881
59- it "reads after ungetc with data in the buffer" do
60- @write . write ( "foobar" )
61- c = @read . getc
62- @read . ungetc ( c )
63- @read . read_nonblock ( 3 ) . should == "foo"
64- @read . read_nonblock ( 3 ) . should == "bar"
65- end
58+ it "reads after ungetc with data in the buffer" do
59+ @write . write ( "foobar" )
60+ @read . set_encoding (
61+ 'utf-8' , universal_newline : false
62+ )
63+ c = @read . getc
64+ @read . ungetc ( c )
65+ @read . read_nonblock ( 3 ) . should == "foo"
66+ @read . read_nonblock ( 3 ) . should == "bar"
67+ end
68+
69+ it "raises an exception after ungetc with data in the buffer and character conversion enabled" do
70+ @write . write ( "foobar" )
71+ @read . set_encoding (
72+ 'utf-8' , universal_newline : true
73+ )
74+ c = @read . getc
75+ @read . ungetc ( c )
76+ -> { @read . read_nonblock ( 3 ) . should == "foo" } . should raise_error ( IOError )
6677 end
6778
6879 it "returns less data if that is all that is available" do
You can’t perform that action at this time.
0 commit comments