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

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

Issue 41703002: Fix GN unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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_script_target_writer.h" 10 #include "tools/gn/ninja_script_target_writer.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 "C:/python/python.exe"))); 119 "C:/python/python.exe")));
120 setup.settings()->set_target_os(Settings::WIN); 120 setup.settings()->set_target_os(Settings::WIN);
121 121
122 std::ostringstream out; 122 std::ostringstream out;
123 NinjaScriptTargetWriter writer(&target, out); 123 NinjaScriptTargetWriter writer(&target, out);
124 writer.Run(); 124 writer.Run();
125 125
126 // TODO(brettw) I think we'll need to worry about backslashes here 126 // TODO(brettw) I think we'll need to worry about backslashes here
127 // depending if we're on actual Windows or Linux pretending to be Windows. 127 // depending if we're on actual Windows or Linux pretending to be Windows.
128 const char expected_win[] = 128 const char expected_win[] =
129 "arch = environment.x86\n"
130 "rule __foo_bar___rule\n" 129 "rule __foo_bar___rule\n"
131 " command = C:/python/python.exe gyp-win-tool action-wrapper $arch __fo o_bar___rule.$unique_name.rsp\n" 130 " command = C:/python/python.exe gyp-win-tool action-wrapper environmen t.x86 __foo_bar___rule.$unique_name.rsp\n"
132 " description = CUSTOM //foo:bar()\n" 131 " description = CUSTOM //foo:bar()\n"
133 " restat = 1\n" 132 " restat = 1\n"
134 " rspfile = __foo_bar___rule.$unique_name.rsp\n" 133 " rspfile = __foo_bar___rule.$unique_name.rsp\n"
135 " rspfile_content = C:/python/python.exe ../../foo/script.py -i ${sourc e} \"--out=foo$ bar${source_name_part}.o\"\n" 134 " rspfile_content = C:/python/python.exe ../../foo/script.py -i ${sourc e} \"--out=foo$ bar${source_name_part}.o\"\n"
136 "\n" 135 "\n"
137 "build input1.out: __foo_bar___rule../../foo/input1.txt | ../../foo/incl uded.txt\n" 136 "build input1.out: __foo_bar___rule../../foo/input1.txt | ../../foo/incl uded.txt\n"
138 " unique_name = 0\n" 137 " unique_name = 0\n"
139 " source = ../../foo/input1.txt\n" 138 " source = ../../foo/input1.txt\n"
140 " source_name_part = input1\n" 139 " source_name_part = input1\n"
141 "build input2.out: __foo_bar___rule../../foo/input2.txt | ../../foo/incl uded.txt\n" 140 "build input2.out: __foo_bar___rule../../foo/input2.txt | ../../foo/incl uded.txt\n"
142 " unique_name = 1\n" 141 " unique_name = 1\n"
143 " source = ../../foo/input2.txt\n" 142 " source = ../../foo/input2.txt\n"
144 " source_name_part = input2\n" 143 " source_name_part = input2\n"
145 "\n" 144 "\n"
146 "build obj/foo/bar.stamp: tc_stamp input1.out input2.out\n"; 145 "build obj/foo/bar.stamp: tc_stamp input1.out input2.out\n";
147 std::string out_str = out.str(); 146 std::string out_str = out.str();
148 #if defined(OS_WIN) 147 #if defined(OS_WIN)
149 std::replace(out_str.begin(), out_str.end(), '\\', '/'); 148 std::replace(out_str.begin(), out_str.end(), '\\', '/');
150 #endif 149 #endif
151 EXPECT_EQ(expected_win, out_str); 150 EXPECT_EQ(expected_win, out_str);
152 } 151 }
153 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698