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

Side by Side Diff: tools/gn/ninja_binary_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 <sstream> 5 #include <sstream>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/ninja_binary_target_writer.h" 8 #include "tools/gn/ninja_binary_target_writer.h"
9 #include "tools/gn/test_with_scope.h" 9 #include "tools/gn/test_with_scope.h"
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 // Source set itself. 22 // Source set itself.
23 { 23 {
24 std::ostringstream out; 24 std::ostringstream out;
25 NinjaBinaryTargetWriter writer(&target, out); 25 NinjaBinaryTargetWriter writer(&target, out);
26 writer.Run(); 26 writer.Run();
27 27
28 // TODO(brettw) I think we'll need to worry about backslashes here 28 // TODO(brettw) I think we'll need to worry about backslashes here
29 // depending if we're on actual Windows or Linux pretending to be Windows. 29 // depending if we're on actual Windows or Linux pretending to be Windows.
30 const char expected_win[] = 30 const char expected_win[] =
31 "arch = environment.x86\n"
32 "defines =\n" 31 "defines =\n"
33 "includes =\n" 32 "includes =\n"
34 "cflags =\n" 33 "cflags =\n"
35 "cflags_c =\n" 34 "cflags_c =\n"
36 "cflags_cc =\n" 35 "cflags_cc =\n"
37 "cflags_objc =\n" 36 "cflags_objc =\n"
38 "cflags_objcc =\n" 37 "cflags_objcc =\n"
39 "\n" 38 "\n"
40 "build obj/foo/bar.input1.obj: tc_cxx ../../foo/input1.cc\n" 39 "build obj/foo/bar.input1.obj: tc_cxx ../../foo/input1.cc\n"
41 "build obj/foo/bar.input2.obj: tc_cxx ../../foo/input2.cc\n" 40 "build obj/foo/bar.input2.obj: tc_cxx ../../foo/input2.cc\n"
(...skipping 13 matching lines...) Expand all
55 shlib_target.OnResolved(); 54 shlib_target.OnResolved();
56 55
57 { 56 {
58 std::ostringstream out; 57 std::ostringstream out;
59 NinjaBinaryTargetWriter writer(&shlib_target, out); 58 NinjaBinaryTargetWriter writer(&shlib_target, out);
60 writer.Run(); 59 writer.Run();
61 60
62 // TODO(brettw) I think we'll need to worry about backslashes here 61 // TODO(brettw) I think we'll need to worry about backslashes here
63 // depending if we're on actual Windows or Linux pretending to be Windows. 62 // depending if we're on actual Windows or Linux pretending to be Windows.
64 const char expected_win[] = 63 const char expected_win[] =
65 "arch = environment.x86\n"
66 "defines =\n" 64 "defines =\n"
67 "includes =\n" 65 "includes =\n"
68 "cflags =\n" 66 "cflags =\n"
69 "cflags_c =\n" 67 "cflags_c =\n"
70 "cflags_cc =\n" 68 "cflags_cc =\n"
71 "cflags_objc =\n" 69 "cflags_objc =\n"
72 "cflags_objcc =\n" 70 "cflags_objcc =\n"
73 "\n" 71 "\n"
74 "\n" 72 "\n"
75 "manifests = obj/foo/shlib.intermediate.manifest\n" 73 "manifests = obj/foo/shlib.intermediate.manifest\n"
76 "ldflags = /MANIFEST /ManifestFile:obj/foo/shlib.intermediate.manifest\n " 74 "ldflags = /MANIFEST /ManifestFile:obj/foo/shlib.intermediate.manifest\n "
77 "libs =\n" 75 "libs =\n"
78 "build shlib.dll shlib.dll.lib: tc_solink obj/foo/bar.input1.obj obj/foo /bar.input2.obj\n" 76 "build shlib.dll shlib.dll.lib: tc_solink obj/foo/bar.input1.obj obj/foo /bar.input2.obj\n"
79 " soname = shlib.dll\n" 77 " soname = shlib.dll\n"
80 " lib = shlib.dll\n" 78 " lib = shlib.dll\n"
81 " dll = shlib.dll\n" 79 " dll = shlib.dll\n"
82 " implibflag = /IMPLIB:shlib.dll.lib\n\n"; 80 " implibflag = /IMPLIB:shlib.dll.lib\n\n";
83 std::string out_str = out.str(); 81 std::string out_str = out.str();
84 #if defined(OS_WIN) 82 #if defined(OS_WIN)
85 std::replace(out_str.begin(), out_str.end(), '\\', '/'); 83 std::replace(out_str.begin(), out_str.end(), '\\', '/');
86 #endif 84 #endif
87 EXPECT_EQ(expected_win, out_str); 85 EXPECT_EQ(expected_win, out_str);
88 } 86 }
89 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698