mirror of
https://github.com/reactos/ninja.git
synced 2024-12-12 13:55:35 +00:00
split out depfile parser tests into new file
This commit is contained in:
parent
ca46af55eb
commit
8b929cf7c8
@ -189,6 +189,7 @@ objs = []
|
||||
for name in ['build_log_test',
|
||||
'build_test',
|
||||
'clean_test',
|
||||
'depfile_parser_test',
|
||||
'disk_interface_test',
|
||||
'edit_distance_test',
|
||||
'eval_env_test',
|
||||
|
50
src/depfile_parser_test.cc
Normal file
50
src/depfile_parser_test.cc
Normal file
@ -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());
|
||||
}
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user