diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-11-11 20:41:25 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-11-14 16:04:43 +0300 |
commit | 44b0a5989f76570fc19dc41314f31c4fa9c2039b (patch) | |
tree | 5d08247adba178575e721e75de976f825974d5b3 /tests/test/simple/generated/driver.cxx | |
parent | 9254560cc32fe219da9d9fe454e396e8f2a13b33 (diff) |
Add buffering for simple test diagnosticsdiag-buffer
Also fix simple test redirecting diff's stdout to stderr.
Diffstat (limited to 'tests/test/simple/generated/driver.cxx')
-rw-r--r-- | tests/test/simple/generated/driver.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test/simple/generated/driver.cxx b/tests/test/simple/generated/driver.cxx index 89dacca..ca6dfcb 100644 --- a/tests/test/simple/generated/driver.cxx +++ b/tests/test/simple/generated/driver.cxx @@ -49,13 +49,23 @@ main (int argc, char* argv[]) } else { - ifstream ifs (argv[i]); + istream* is; + ifstream ifs; - if (!ifs.is_open ()) - cerr << "unable to open " << argv[1] << endl; + if (argv[i] != string ("-")) + { + ifs.open (argv[i]); + + if (!ifs.is_open ()) + cerr << "unable to open " << argv[1] << endl; + + is = &ifs; + } + else + is = &cin; string s; - r = getline (ifs, s) && s == "1.2.3" ? 0 : 1; + r = getline (*is, s) && s == "1.2.3" ? 0 : 1; } return r; |