
When running tests using the "sim" config, the command is launched in non-readonly mode and the text retrieved from the expect command will then replace all LF with CRLF. (The problem can be found in sim_load where it calls remote_spawn without an input file). libstdc++-v3/ChangeLog: * testsuite/27_io/print/1.cc: Allow both LF and CRLF in test. * testsuite/27_io/print/3.cc: Likewise. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
53 lines
878 B
C++
53 lines
878 B
C++
// { dg-additional-options "-lstdc++exp" { target { *-*-mingw* } } }
|
|
// { dg-do run { target c++23 } }
|
|
// { dg-require-fileio "" }
|
|
|
|
#include <print>
|
|
#include <cstdio>
|
|
#include <testsuite_hooks.h>
|
|
#include <testsuite_fs.h>
|
|
|
|
void
|
|
test_println_blank()
|
|
{
|
|
std::print("1");
|
|
std::println();
|
|
std::println("2");
|
|
// { dg-output "1\r?\n2" }
|
|
}
|
|
|
|
void
|
|
test_println_blank_file()
|
|
{
|
|
__gnu_test::scoped_file f;
|
|
FILE* strm = std::fopen(f.path.string().c_str(), "w");
|
|
VERIFY( strm );
|
|
std::println(strm);
|
|
std::fclose(strm);
|
|
|
|
std::ifstream in(f.path);
|
|
std::string txt(std::istreambuf_iterator<char>(in), {});
|
|
VERIFY( txt == "\n" );
|
|
}
|
|
|
|
void
|
|
test_errors()
|
|
{
|
|
#ifdef __cpp_exceptions
|
|
try
|
|
{
|
|
std::println(stdin);
|
|
VERIFY(false);
|
|
}
|
|
catch (const std::system_error&)
|
|
{
|
|
}
|
|
#endif
|
|
}
|
|
|
|
int main()
|
|
{
|
|
test_println_blank();
|
|
test_println_blank_file();
|
|
test_errors();
|
|
}
|