Improve C++ example
--
MOS_MIGRATED_REVID=87514947
diff --git a/base_workspace/examples/cpp/hello-fail.cc b/base_workspace/examples/cpp/hello-fail.cc
index 9b0b94a..5b561cb 100644
--- a/base_workspace/examples/cpp/hello-fail.cc
+++ b/base_workspace/examples/cpp/hello-fail.cc
@@ -1,11 +1,22 @@
#include "examples/cpp/hello-lib.h"
+#include <string>
+
+using hello::HelloLib;
+using std::string;
+
+/**
+ * This is a fake test that prints "Hello barf" and then exits with exit code 1.
+ * If run as a test (cc_test), the non-0 exit code indicates to Bazel that the
+ * "test" has failed.
+ */
int main(int argc, char** argv) {
- const char* obj = "barf";
+ HelloLib lib;
+ string thing = "barf";
if (argc > 1) {
- obj = argv[1];
+ thing = argv[1];
}
- greet(obj);
+ lib.greet(thing);
return 1;
}