Joe Onorato | 175073c | 2023-06-01 14:42:59 -0700 | [diff] [blame^] | 1 | // 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 | |
| 15 | package device_config |
| 16 | |
| 17 | import ( |
| 18 | "strings" |
| 19 | "testing" |
| 20 | |
| 21 | "android/soong/android" |
| 22 | ) |
| 23 | |
| 24 | func TestDeviceConfigDefinitions(t *testing.T) { |
| 25 | bp := ` |
| 26 | device_config_definitions { |
| 27 | name: "module_name", |
| 28 | namespace: "com.example.package", |
| 29 | 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) |
| 38 | android.AssertStringEquals(t, "namespace", depData.namespace, "com.example.package") |
| 39 | if !strings.HasSuffix(depData.intermediatePath.String(), "/intermediate.json") { |
| 40 | t.Errorf("Missing intermediates path in provider: %s", depData.intermediatePath.String()) |
| 41 | } |
| 42 | } |