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

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

Issue 1160773002: Add support for module-definition files to gn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove conditional compilation and add tests Created 5 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
« no previous file with comments | « tools/gn/ninja_binary_target_writer.cc ('k') | tools/gn/source_file_type.h » ('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 <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/target.h" 9 #include "tools/gn/target.h"
10 #include "tools/gn/test_with_scope.h" 10 #include "tools/gn/test_with_scope.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 "\n" 350 "\n"
351 "build obj/foo/exe.final.o: cxx ../../foo/final.cc\n" 351 "build obj/foo/exe.final.o: cxx ../../foo/final.cc\n"
352 "\n" 352 "\n"
353 "build ./exe: link obj/foo/exe.final.o obj/foo/inter.inter.o || " 353 "build ./exe: link obj/foo/exe.final.o obj/foo/inter.inter.o || "
354 "obj/foo/inter.stamp\n" 354 "obj/foo/inter.stamp\n"
355 " ldflags =\n" 355 " ldflags =\n"
356 " libs =\n" 356 " libs =\n"
357 " output_extension = \n"; 357 " output_extension = \n";
358 EXPECT_EQ(final_expected, final_out.str()); 358 EXPECT_EQ(final_expected, final_out.str());
359 } 359 }
360
361 TEST(NinjaBinaryTargetWriter, SharedLibraryModuleDefinitionFile) {
362 TestWithScope setup;
363 setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
364 setup.settings()->set_target_os(Settings::WIN);
365
366 Target shared_lib(setup.settings(), Label(SourceDir("//foo/"), "bar"));
367 shared_lib.set_output_type(Target::SHARED_LIBRARY);
368 shared_lib.SetToolchain(setup.toolchain());
369 shared_lib.sources().push_back(SourceFile("//foo/sources.cc"));
370 shared_lib.sources().push_back(SourceFile("//foo/bar.def"));
371
372 Err err;
373 ASSERT_TRUE(shared_lib.OnResolved(&err));
374
375 std::ostringstream out;
376 NinjaBinaryTargetWriter writer(&shared_lib, out);
377 writer.Run();
378
379 const char expected[] =
380 "defines =\n"
381 "include_dirs =\n"
382 "cflags =\n"
383 "cflags_c =\n"
384 "cflags_cc =\n"
385 "cflags_objc =\n"
386 "cflags_objcc =\n"
387 "root_out_dir = .\n"
388 "target_out_dir = obj/foo\n"
389 "target_output_name = libbar\n"
390 "\n"
391 "build obj/foo/libbar.sources.o: cxx ../../foo/sources.cc\n"
392 "\n"
393 "build ./libbar.so: solink obj/foo/libbar.sources.o | ../../foo/bar.def\n"
394 " ldflags = /DEF:../../foo/bar.def\n"
395 " libs =\n"
396 " output_extension = .so\n";
397 EXPECT_EQ(expected, out.str());
398 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_binary_target_writer.cc ('k') | tools/gn/source_file_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698