martine/ninja — pull request #812 by nico (2014-09-14 20:20:53+00:00)
Title: Use a small, standalone testing framework for ninja instead of googletest.

@martine I'd be interested what you think about this. It's more RFC than pull request (motivated by me reading re2 source).

Ninja currently uses googletest for testing. That makes building ninja_test somewhat annoying since it requires that one passes `--with-gtest PATH` to configure. It turns out just implementing the bits of googletest that ninja uses needs about the same amount of code than making the `--with-gtest` flag in configure.py work and making googletest print test results in a way we want (!)

In addition to making configuration simpler, this also makes compiling tests much faster: On my system, touching src/build_test.cc (the slowest file to build in ninja) and rebuilding ninja_tests is twice as fast than without this patch. Building `all` is noticeably faster too: 5.6s with this patch, 9.1s without this patch (38% faster).

The most noticeable things missing: EXPECT_* and ASSERT_* don't support streaming notes to them with operator<<, and for failing tests the lhs and rhs are not printed. That's so that this header does not have to include sstream, which slows down building ninja_test almost 20%. It could be added with just a handful lines if this turns out to be very annoying, though.