Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions checktestdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ int main(int argc, char **argv)
fstream fdata;
if ( argc>optind+1 ) {
char *datafile = argv[optind+1];
if ( datafile==string("-") ) goto use_stdin;
if ( filesystem::is_directory(datafile) ) {
cerr << "Expected a file instead of a directory: '" << datafile << "'.\n";
exit(exit_failure);
Expand All @@ -160,6 +161,7 @@ int main(int argc, char **argv)
exit(exit_failure);
}
}
use_stdin:
iostream& data = fdata.is_open() ? static_cast<iostream&>(fdata)
: (generate ? static_cast<iostream&>(cout)
: static_cast<iostream&>(cin) );
Expand Down
8 changes: 8 additions & 0 deletions libchecktestdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ void readtestdata(istream &in)
data = databuffer(std::move(buffer));
return;
}
} else {
in.clear();
stringstream ss;
ss << in.rdbuf();
if (!in.fail()) {
data = databuffer(ss.str());
return;
}
}

cerr << "error reading testdata" << endl;
Expand Down
Loading