aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/cpp/hello-fail.cc
blob: 5fb2292354a4abc6e6ea8b5542737122cba823a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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("Hello");
  string thing = "barf";
  if (argc > 1) {
    thing = argv[1];
  }

  lib.greet(thing);
  return 1;
}