summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/error.cc2
-rw-r--r--src/session.cc1
-rw-r--r--test/regress/BF3C1F82.test12
3 files changed, 14 insertions, 1 deletions
diff --git a/src/error.cc b/src/error.cc
index 58339db7..d7e92daa 100644
--- a/src/error.cc
+++ b/src/error.cc
@@ -84,7 +84,7 @@ string source_context(const path& file,
const string& prefix)
{
const std::streamoff len = end_pos - pos;
- if (! len || file == path("/dev/stdin"))
+ if (! len || file == path("/dev/stdin") || file.empty())
return _("<no source context>");
assert(len > 0);
diff --git a/src/session.cc b/src/session.cc
index b6153203..a8bb628a 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -159,6 +159,7 @@ std::size_t session_t::read_data(const string& master_account)
shared_ptr<std::istream> stream(new std::istringstream(buffer.str()));
parsing_context.push(stream);
+ parsing_context.get_current().pathname = "/dev/stdin";
} else {
parsing_context.push(pathname);
}
diff --git a/test/regress/BF3C1F82.test b/test/regress/BF3C1F82.test
new file mode 100644
index 00000000..8d465f4d
--- /dev/null
+++ b/test/regress/BF3C1F82.test
@@ -0,0 +1,12 @@
+; Check that error reporting works for "-f -"
+
+2012/02/30 * Test
+ a 1
+ b
+test -f - reg -> 1
+__ERROR__
+While parsing file "/dev/stdin", line 3:
+While parsing transaction:
+<no source context>
+Error: Day of month is not valid for year
+end test