Actions
Bug #400
closedPossible bug in IO#ungetc
Description
=begin
According to the documentation for IO#ungetc:
bq.
"Only one character may be pushed back before a subsequent
read operation (that is, you will be able to read only the
last of several characters that have been pushed back)."
But that doesn't seem to be the case:
file.txt
Voici la ligne une.
Qui è la linea due.
Aquà está la lÃnea tres.
Ist hier Linie vier.
Está aqui a linha cinco.
Here is line six.
Rubyspec:
@file = File.open("file.txt", "r")
@file.getc
10.times { @file.ungetc(90) }
@file.ungetc(80)
@file.read(1).should == "P"
@file.readline.should == "oici la ligne une.\n"
#=> IO#ungetc pushing back only one character FAILED
Expected "ZZZZZZZZZZoici la ligne une.\n"
to equal "oici la ligne une.\n"
Are we misunderstanding the documentation and this works as expected or is it a bug indeed?
=end
Actions
Like0
Like0Like0Like0Like0