diff options
author | 2021-03-16 23:57:12 +0000 | |
---|---|---|
committer | 2021-03-18 12:18:09 +0000 | |
commit | d9ec7d26940acf25eb7c7b4cd80a42783a8e7a7a (patch) | |
tree | c646299cd74229256b498e796dd0a3de681eb804 | |
parent | 78c36216a8cbf7411bd3ec6b28c7a9827a6d9267 (diff) |
Convert android/ninja_deps_test.go to test fixtures
Bug: 182885307
Test: m nothing
Change-Id: Iccba8caffc7e5a82ff13d93a032edcf3f748fc40
-rw-r--r-- | android/ninja_deps_test.go | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/android/ninja_deps_test.go b/android/ninja_deps_test.go index d3775edd9..7e5864d5b 100644 --- a/android/ninja_deps_test.go +++ b/android/ninja_deps_test.go @@ -53,23 +53,20 @@ func (testNinjaDepsSingleton) GenerateBuildActions(ctx SingletonContext) { } func TestNinjaDeps(t *testing.T) { - fs := map[string][]byte{ + fs := MockFS{ "test_ninja_deps/exists": nil, } - config := TestConfig(buildDir, nil, "", fs) - ctx := NewTestContext(config) - ctx.RegisterSingletonType("test_ninja_deps_singleton", testNinjaDepsSingletonFactory) - ctx.RegisterSingletonType("ninja_deps_singleton", ninjaDepsSingletonFactory) - ctx.Register() - - _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) - FailIfErrored(t, errs) - ninjaDeps, errs := ctx.PrepareBuildActions(config) - FailIfErrored(t, errs) + result := emptyTestFixtureFactory.RunTest(t, + FixtureRegisterWithContext(func(ctx RegistrationContext) { + ctx.RegisterSingletonType("test_ninja_deps_singleton", testNinjaDepsSingletonFactory) + ctx.RegisterSingletonType("ninja_deps_singleton", ninjaDepsSingletonFactory) + }), + fs.AddToFixture(), + ) // Verify that the ninja file has a dependency on the test_ninja_deps directory. - if g, w := ninjaDeps, "test_ninja_deps"; !InList(w, g) { + if g, w := result.NinjaDeps, "test_ninja_deps"; !InList(w, g) { t.Errorf("expected %q in %q", w, g) } } |