Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: tools/gn/ninja_action_target_writer_unittest.cc

Issue 334333005: Add directory extraction to GN path handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to new file template function Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/ninja_action_target_writer.cc ('k') | tools/gn/ninja_copy_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "tools/gn/file_template.h" 9 #include "tools/gn/file_template.h"
10 #include "tools/gn/ninja_action_target_writer.h" 10 #include "tools/gn/ninja_action_target_writer.h"
(...skipping 26 matching lines...) Expand all
37 setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/")); 37 setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
38 Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); 38 Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
39 39
40 std::ostringstream out; 40 std::ostringstream out;
41 NinjaActionTargetWriter writer(&target, setup.toolchain(), out); 41 NinjaActionTargetWriter writer(&target, setup.toolchain(), out);
42 42
43 std::vector<std::string> args; 43 std::vector<std::string> args;
44 args.push_back("-i"); 44 args.push_back("-i");
45 args.push_back("{{source}}"); 45 args.push_back("{{source}}");
46 args.push_back("--out=foo bar{{source_name_part}}.o"); 46 args.push_back("--out=foo bar{{source_name_part}}.o");
47 FileTemplate args_template(args); 47 FileTemplate args_template(setup.settings(), args);
48 48
49 writer.WriteArgsSubstitutions(SourceFile("//foo/b ar.in"), args_template); 49 writer.WriteArgsSubstitutions(SourceFile("//foo/b ar.in"), args_template);
50 #if defined(OS_WIN) 50 #if defined(OS_WIN)
51 EXPECT_EQ(" source = \"../../foo/b$ ar.in\"\n" 51 EXPECT_EQ(" source = \"../../foo/b$ ar.in\"\n"
52 " source_name_part = \"b$ ar\"\n", 52 " source_name_part = \"b$ ar\"\n",
53 out.str()); 53 out.str());
54 #else 54 #else
55 EXPECT_EQ(" source = ../../foo/b\\$ ar.in\n" 55 EXPECT_EQ(" source = ../../foo/b\\$ ar.in\n"
56 " source_name_part = b\\$ ar\n", 56 " source_name_part = b\\$ ar\n",
57 out.str()); 57 out.str());
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 " | obj/foo/bar.inputdeps.stamp\n" 343 " | obj/foo/bar.inputdeps.stamp\n"
344 " unique_name = 1\n" 344 " unique_name = 1\n"
345 " source = ../../foo/input2.txt\n" 345 " source = ../../foo/input2.txt\n"
346 " source_name_part = input2\n" 346 " source_name_part = input2\n"
347 " depfile = gen/input2.d\n" 347 " depfile = gen/input2.d\n"
348 "\n" 348 "\n"
349 "build obj/foo/bar.stamp: stamp input1.out input2.out\n"; 349 "build obj/foo/bar.stamp: stamp input1.out input2.out\n";
350 EXPECT_EQ(expected_win, out.str()); 350 EXPECT_EQ(expected_win, out.str());
351 } 351 }
352 } 352 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_action_target_writer.cc ('k') | tools/gn/ninja_copy_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698