aconfig_declarations_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. package aconfig
  15. import (
  16. "strings"
  17. "testing"
  18. "android/soong/android"
  19. )
  20. func TestAconfigDeclarations(t *testing.T) {
  21. bp := `
  22. aconfig_declarations {
  23. name: "module_name",
  24. package: "com.example.package",
  25. srcs: ["foo.aconfig"],
  26. }
  27. `
  28. result := runTest(t, android.FixtureExpectsNoErrors, bp)
  29. module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
  30. // Check that the provider has the right contents
  31. depData := result.ModuleProvider(module, declarationsProviderKey).(declarationsProviderData)
  32. android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
  33. if !strings.HasSuffix(depData.IntermediatePath.String(), "/intermediate.pb") {
  34. t.Errorf("Missing intermediates path in provider: %s", depData.IntermediatePath.String())
  35. }
  36. }