| Index: trunk/src/tools/gn/scope_per_file_provider_unittest.cc
|
| ===================================================================
|
| --- trunk/src/tools/gn/scope_per_file_provider_unittest.cc (revision 232660)
|
| +++ trunk/src/tools/gn/scope_per_file_provider_unittest.cc (working copy)
|
| @@ -6,26 +6,34 @@
|
| #include "tools/gn/build_settings.h"
|
| #include "tools/gn/scope_per_file_provider.h"
|
| #include "tools/gn/settings.h"
|
| -#include "tools/gn/test_with_scope.h"
|
| #include "tools/gn/toolchain.h"
|
| #include "tools/gn/variables.h"
|
|
|
| TEST(ScopePerFileProvider, Expected) {
|
| - TestWithScope test;
|
| + Err err;
|
|
|
| + BuildSettings build_settings;
|
| + build_settings.toolchain_manager().SetDefaultToolchainUnlocked(
|
| + Label(SourceDir("//toolchain/"), "default", SourceDir(), ""),
|
| + LocationRange(), &err);
|
| + EXPECT_FALSE(err.has_error());
|
| +
|
| + build_settings.SetBuildDir(SourceDir("//out/Debug/"));
|
| +
|
| // Prevent horrible wrapping of calls below.
|
| #define GPV(val) provider.GetProgrammaticValue(val)->string_value()
|
|
|
| // Test the default toolchain.
|
| {
|
| - Scope scope(test.settings());
|
| + Toolchain toolchain(Label(SourceDir("//toolchain/"), "tc"));
|
| + Settings settings(&build_settings, &toolchain, std::string());
|
| +
|
| + Scope scope(&settings);
|
| scope.set_source_dir(SourceDir("//source/"));
|
| ScopePerFileProvider provider(&scope);
|
|
|
| - EXPECT_EQ("//toolchain:default", GPV(variables::kCurrentToolchain));
|
| - // TODO(brettw) this test harness does not set up the Toolchain manager
|
| - // which is the source of this value, so we can't test this yet.
|
| - //EXPECT_EQ("//toolchain:default", GPV(variables::kDefaultToolchain));
|
| + EXPECT_EQ("//toolchain:tc", GPV(variables::kCurrentToolchain));
|
| + EXPECT_EQ("//toolchain:default", GPV(variables::kDefaultToolchain));
|
| EXPECT_EQ("//out/Debug", GPV(variables::kRootBuildDir));
|
| EXPECT_EQ("//out/Debug/gen", GPV(variables::kRootGenDir));
|
| EXPECT_EQ("//out/Debug", GPV(variables::kRootOutDir));
|
| @@ -35,17 +43,13 @@
|
|
|
| // Test some with an alternate toolchain.
|
| {
|
| - Settings settings(test.build_settings(), "tc");
|
| - Toolchain toolchain(&settings, Label(SourceDir("//toolchain/"), "tc"));
|
| - settings.set_toolchain_label(toolchain.label());
|
| + Toolchain toolchain(Label(SourceDir("//toolchain/"), "tc"));
|
| + Settings settings(&build_settings, &toolchain, "tc");
|
|
|
| Scope scope(&settings);
|
| scope.set_source_dir(SourceDir("//source/"));
|
| ScopePerFileProvider provider(&scope);
|
|
|
| - EXPECT_EQ("//toolchain:tc", GPV(variables::kCurrentToolchain));
|
| - // See above.
|
| - //EXPECT_EQ("//toolchain:default", GPV(variables::kDefaultToolchain));
|
| EXPECT_EQ("//out/Debug", GPV(variables::kRootBuildDir));
|
| EXPECT_EQ("//out/Debug/tc/gen", GPV(variables::kRootGenDir));
|
| EXPECT_EQ("//out/Debug/tc", GPV(variables::kRootOutDir));
|
|
|