blob: 5838523f905f0f88fd9279b76d4b108ec3c932f4 [file] [log] [blame]
Joe Onorato175073c2023-06-01 14:42:59 -07001// Copyright 2018 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package device_config
16
17import (
18 "strings"
19 "testing"
20
21 "android/soong/android"
22)
23
24func TestDeviceConfigDefinitions(t *testing.T) {
25 bp := `
26 device_config_definitions {
27 name: "module_name",
Joe Onorato81b25ed2023-06-21 13:49:37 -070028 package: "com.example.package",
Joe Onorato175073c2023-06-01 14:42:59 -070029 srcs: ["foo.aconfig"],
30 }
31 `
32 result := runTest(t, android.FixtureExpectsNoErrors, bp)
33
34 module := result.ModuleForTests("module_name", "").Module().(*DefinitionsModule)
35
36 // Check that the provider has the right contents
37 depData := result.ModuleProvider(module, definitionsProviderKey).(definitionsProviderData)
Joe Onorato81b25ed2023-06-21 13:49:37 -070038 android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
39 if !strings.HasSuffix(depData.IntermediatePath.String(), "/intermediate.pb") {
40 t.Errorf("Missing intermediates path in provider: %s", depData.IntermediatePath.String())
Joe Onorato175073c2023-06-01 14:42:59 -070041 }
42}