| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "tools/gn/err.h" | 6 #include "tools/gn/err.h" |
| 7 #include "tools/gn/label.h" | 7 #include "tools/gn/label.h" |
| 8 #include "tools/gn/scope.h" |
| 8 #include "tools/gn/value.h" | 9 #include "tools/gn/value.h" |
| 9 #include "tools/gn/visibility.h" | 10 #include "tools/gn/visibility.h" |
| 10 | 11 |
| 11 TEST(Visibility, CanSeeMe) { | 12 TEST(Visibility, CanSeeMe) { |
| 12 Value list(nullptr, Value::LIST); | 13 Value list(nullptr, Value::LIST); |
| 13 list.list_value().push_back(Value(nullptr, "//rec/*")); // Recursive. | 14 list.list_value().push_back(Value(nullptr, "//rec/*")); // Recursive. |
| 14 list.list_value().push_back(Value(nullptr, "//dir:*")); // One dir. | 15 list.list_value().push_back(Value(nullptr, "//dir:*")); // One dir. |
| 15 list.list_value().push_back(Value(nullptr, "//my:name")); // Exact match. | 16 list.list_value().push_back(Value(nullptr, "//my:name")); // Exact match. |
| 16 | 17 |
| 17 Err err; | 18 Err err; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 } | 44 } |
| 44 | 45 |
| 45 TEST(Visibility, Private) { | 46 TEST(Visibility, Private) { |
| 46 Err err; | 47 Err err; |
| 47 Visibility vis; | 48 Visibility vis; |
| 48 ASSERT_TRUE(vis.Set(SourceDir("//"), Value(nullptr, Value::LIST), &err)); | 49 ASSERT_TRUE(vis.Set(SourceDir("//"), Value(nullptr, Value::LIST), &err)); |
| 49 | 50 |
| 50 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//random/"), "thing"))); | 51 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//random/"), "thing"))); |
| 51 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//"), ""))); | 52 EXPECT_FALSE(vis.CanSeeMe(Label(SourceDir("//"), ""))); |
| 52 } | 53 } |
| OLD | NEW |