diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-09-18 02:48:26 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-09-18 02:48:26 (GMT) |
commit | b2fe56caaf0bed497ee480003f10486c18d8de9a (patch) | |
tree | 8d32bf2472cb6fd4344650f24b38421221fcc738 /src/manifest_parser_test.cc | |
parent | 1d9184c3adbfabacb844b0a715a64b08998c204f (diff) | |
download | Ninja-b2fe56caaf0bed497ee480003f10486c18d8de9a.zip Ninja-b2fe56caaf0bed497ee480003f10486c18d8de9a.tar.gz Ninja-b2fe56caaf0bed497ee480003f10486c18d8de9a.tar.bz2 |
Use a small, standalone testing framework instead of googletest.
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%.
If this turns out to be annoying, we can maybe add it.
Diffstat (limited to 'src/manifest_parser_test.cc')
-rw-r--r-- | src/manifest_parser_test.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 152b965..ee87c94 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -17,17 +17,16 @@ #include <map> #include <vector> -#include <gtest/gtest.h> - #include "graph.h" #include "state.h" +#include "test.h" struct ParserTest : public testing::Test, public ManifestParser::FileReader { void AssertParse(const char* input) { ManifestParser parser(&state, this); string err; - ASSERT_TRUE(parser.ParseTest(input, &err)) << err; + EXPECT_TRUE(parser.ParseTest(input, &err)); ASSERT_EQ("", err); } |