summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-12-19 18:59:29 (GMT)
committerEvan Martin <martine@danga.com>2011-12-19 19:18:47 (GMT)
commit8b929cf7c82b5ff84a874c5a25e919446c3874d5 (patch)
tree634d0eac640d4877560dc22250cb5191c5794e69 /src
parentca46af55eb61373b92e49e936a65a465ed277f51 (diff)
downloadNinja-8b929cf7c82b5ff84a874c5a25e919446c3874d5.zip
Ninja-8b929cf7c82b5ff84a874c5a25e919446c3874d5.tar.gz
Ninja-8b929cf7c82b5ff84a874c5a25e919446c3874d5.tar.bz2
split out depfile parser tests into new file
Diffstat (limited to 'src')
-rw-r--r--src/depfile_parser_test.cc50
-rw-r--r--src/parsers_test.cc34
2 files changed, 50 insertions, 34 deletions
diff --git a/src/depfile_parser_test.cc b/src/depfile_parser_test.cc
new file mode 100644
index 0000000..3258529
--- /dev/null
+++ b/src/depfile_parser_test.cc
@@ -0,0 +1,50 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "depfile_parser.h"
+
+#include <gtest/gtest.h>
+
+TEST(DepfileParser, Basic) {
+ DepfileParser parser;
+ string err;
+ EXPECT_TRUE(parser.Parse(
+"build/ninja.o: ninja.cc ninja.h eval_env.h manifest_parser.h\n",
+ &err));
+ ASSERT_EQ("", err);
+ EXPECT_EQ("build/ninja.o", parser.out_.AsString());
+ EXPECT_EQ(4u, parser.ins_.size());
+}
+
+TEST(DepfileParser, EarlyNewlineAndWhitespace) {
+ DepfileParser parser;
+ string err;
+ EXPECT_TRUE(parser.Parse(
+" \\\n"
+" out: in\n",
+ &err));
+ ASSERT_EQ("", err);
+}
+
+TEST(DepfileParser, Continuation) {
+ DepfileParser parser;
+ string err;
+ EXPECT_TRUE(parser.Parse(
+"foo.o: \\\n"
+" bar.h baz.h\n",
+ &err));
+ ASSERT_EQ("", err);
+ EXPECT_EQ("foo.o", parser.out_.AsString());
+ EXPECT_EQ(2u, parser.ins_.size());
+}
diff --git a/src/parsers_test.cc b/src/parsers_test.cc
index 0e6d532..71cfed3 100644
--- a/src/parsers_test.cc
+++ b/src/parsers_test.cc
@@ -16,7 +16,6 @@
#include <gtest/gtest.h>
-#include "depfile_parser.h"
#include "graph.h"
#include "state.h"
@@ -487,36 +486,3 @@ TEST_F(ParserTest, DefaultStatements) {
EXPECT_EQ("b", nodes[1]->path());
EXPECT_EQ("c", nodes[2]->path());
}
-
-TEST(DepfileParser, Basic) {
- DepfileParser parser;
- string err;
- EXPECT_TRUE(parser.Parse(
-"build/ninja.o: ninja.cc ninja.h eval_env.h manifest_parser.h\n",
- &err));
- ASSERT_EQ("", err);
- EXPECT_EQ("build/ninja.o", parser.out_.AsString());
- EXPECT_EQ(4u, parser.ins_.size());
-}
-
-TEST(DepfileParser, EarlyNewlineAndWhitespace) {
- DepfileParser parser;
- string err;
- EXPECT_TRUE(parser.Parse(
-" \\\n"
-" out: in\n",
- &err));
- ASSERT_EQ("", err);
-}
-
-TEST(DepfileParser, Continuation) {
- DepfileParser parser;
- string err;
- EXPECT_TRUE(parser.Parse(
-"foo.o: \\\n"
-" bar.h baz.h\n",
- &err));
- ASSERT_EQ("", err);
- EXPECT_EQ("foo.o", parser.out_.AsString());
- EXPECT_EQ(2u, parser.ins_.size());
-}