aboutsummaryrefslogtreecommitdiff
path: root/tests/test/simple/generated/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test/simple/generated/driver.cxx')
-rw-r--r--tests/test/simple/generated/driver.cxx18
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;