Commit 7c7688c7 by Brent Verner Committed by Benjamin Kosnik

istream.tcc: Removed test for _M_gcount < in_avail()...



2000-10-05  Brent Verner  <brent@rcfile.org>

        * bits/istream.tcc [basic_istream::get(basic_streambuf&)]: Removed
	test for _M_gcount < in_avail(), as in_avail() only reports info
	for current buffer, causing method to return at end of buffer.
	* testsuite/27_io/istream_unformatted.cc [test07()]: New test.
	* testsuite/27_io/istream_unformatted-3.txt: New file.
	* testsuite/27_io/istream_unformatted-3.tst: New file.

From-SVN: r36752
parent 3a1ed6a1
...@@ -588,9 +588,8 @@ namespace std { ...@@ -588,9 +588,8 @@ namespace std {
bool __testdelim = __c == __idelim; bool __testdelim = __c == __idelim;
bool __testeof = __c == __eof; bool __testeof = __c == __eof;
bool __testput = true; bool __testput = true;
streamsize __n = __this_sb->in_avail();
while (_M_gcount <= __n && !__testeof && !__testdelim while (!__testeof && !__testdelim
&& (__testput = __sb.sputc(traits_type::to_char_type(__c)) && (__testput = __sb.sputc(traits_type::to_char_type(__c))
!= __eof)) != __eof))
{ {
......
...@@ -452,6 +452,27 @@ test06() ...@@ -452,6 +452,27 @@ test06()
return 0; return 0;
} }
// bug reported by bgarcia@laurelnetworks.com
// http://sources.redhat.com/ml/libstdc++-prs/2000-q3/msg00041.html
int
test07()
{
const char* tfn = "testsuite/istream_unformatted-3.txt";
std::ifstream infile;
infile.open(tfn);
VERIFY( infile );
while (infile)
{
std::string line;
std::ostringstream line_ss;
while (infile.peek() == '\n')
infile.get();
infile.get(*(line_ss.rdbuf()));
line = line_ss.str();
VERIFY( line == "1234567890" || line == "" );
}
return 0;
}
int int
main() main()
...@@ -462,6 +483,7 @@ main() ...@@ -462,6 +483,7 @@ main()
test04(); test04();
test05(); test05();
test06(); test06();
test07();
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment