| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 std::string out_str = out.str(); | 43 std::string out_str = out.str(); |
| 44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 45 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 45 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
| 46 #endif | 46 #endif |
| 47 EXPECT_EQ(expected_win, out_str); | 47 EXPECT_EQ(expected_win, out_str); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // A shared library that depends on the source set. | 50 // A shared library that depends on the source set. |
| 51 Target shlib_target(setup.settings(), Label(SourceDir("//foo/"), "shlib")); | 51 Target shlib_target(setup.settings(), Label(SourceDir("//foo/"), "shlib")); |
| 52 shlib_target.set_output_type(Target::SHARED_LIBRARY); | 52 shlib_target.set_output_type(Target::SHARED_LIBRARY); |
| 53 shlib_target.deps().push_back(&target); | 53 shlib_target.deps().push_back(LabelTargetPair(&target)); |
| 54 shlib_target.OnResolved(); | 54 shlib_target.OnResolved(); |
| 55 | 55 |
| 56 { | 56 { |
| 57 std::ostringstream out; | 57 std::ostringstream out; |
| 58 NinjaBinaryTargetWriter writer(&shlib_target, out); | 58 NinjaBinaryTargetWriter writer(&shlib_target, out); |
| 59 writer.Run(); | 59 writer.Run(); |
| 60 | 60 |
| 61 // 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 |
| 62 // 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. |
| 63 const char expected_win[] = | 63 const char expected_win[] = |
| (...skipping 14 matching lines...) Expand all Loading... |
| 78 " lib = shlib.dll\n" | 78 " lib = shlib.dll\n" |
| 79 " dll = shlib.dll\n" | 79 " dll = shlib.dll\n" |
| 80 " implibflag = /IMPLIB:shlib.dll.lib\n\n"; | 80 " implibflag = /IMPLIB:shlib.dll.lib\n\n"; |
| 81 std::string out_str = out.str(); | 81 std::string out_str = out.str(); |
| 82 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
| 83 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 83 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
| 84 #endif | 84 #endif |
| 85 EXPECT_EQ(expected_win, out_str); | 85 EXPECT_EQ(expected_win, out_str); |
| 86 } | 86 } |
| 87 } | 87 } |
| OLD | NEW |