A poor man's release-time assert for failing to open the test data file.

This patch prevents running unit tests from an incorrect directory in
release mode. Release mode builds ignore assert(file.is_open()) for the
test data file, which causes many hard-to-diagnose crashes due to the
rest of the code relying on that file being open. See
http://crbug.com/395169 and http://crbug.com/396203 for examples.

R=roubert@google.com

Review URL: https://codereview.appspot.com/116200043

git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@316 38ededc0-08b8-5190-f2ac-b31f878777ad
diff --git a/cpp/test/fake_downloader.cc b/cpp/test/fake_downloader.cc
index ae16b77..c642eac 100644
--- a/cpp/test/fake_downloader.cc
+++ b/cpp/test/fake_downloader.cc
@@ -16,7 +16,9 @@
 
 #include <cassert>
 #include <cstddef>
+#include <cstdlib>
 #include <fstream>
+#include <iostream>
 #include <map>
 #include <string>
 #include <utility>
@@ -72,7 +74,10 @@
 std::map<std::string, std::string> InitData() {
   std::map<std::string, std::string> data;
   std::ifstream file(kDataFileName);
-  assert(file.is_open());
+  if (!file.is_open()) {
+    std::cerr << "Error opening \"" << kDataFileName << "\"." << std::endl;
+    std::exit(EXIT_FAILURE);
+  }
 
   std::string line;
   while (file.good()) {