diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2015-03-24 09:05:08 +0000 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@google.com> | 2015-03-24 16:41:48 +0000 |
commit | adeef73a97cf191301a7b563883a075caed733b7 (patch) | |
tree | c06734cbffa4160b156779da7c87dbf5cc2b6f94 /examples/cpp/hello-fail.cc | |
parent | 5247ff53465afc6ad9db889d1ec3f106ec09a3d6 (diff) |
Move all examples into Bazel workspace
Those examples will be used for Bazel integration tests and their
sources should be available directly to the Bazel workspace itself.
--
MOS_MIGRATED_REVID=89380736
Diffstat (limited to 'examples/cpp/hello-fail.cc')
-rw-r--r-- | examples/cpp/hello-fail.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/cpp/hello-fail.cc b/examples/cpp/hello-fail.cc new file mode 100644 index 0000000000..5b561cb0ce --- /dev/null +++ b/examples/cpp/hello-fail.cc @@ -0,0 +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) { + HelloLib lib; + string thing = "barf"; + if (argc > 1) { + thing = argv[1]; + } + + lib.greet(thing); + return 1; +} |