Move sh_binary tests for bp2build into their own file.

Test: go test passes for refactored tests.
Change-Id: Ie094031f4b1f190aa711a37d40bacb182e277b26
This commit is contained in:
Rupert Shuttleworth
2021-02-11 03:40:05 +00:00
parent 56ca4e4706
commit fb97fdee6b
3 changed files with 135 additions and 24 deletions

View File

@@ -17,7 +17,6 @@ package bp2build
import (
"android/soong/android"
"android/soong/genrule"
"android/soong/sh"
"strings"
"testing"
)
@@ -358,12 +357,6 @@ load("//build/bazel/rules:java.bzl", "java_binary")`,
ruleClass: "genrule",
// Note: no bzlLoadLocation for native rules
},
BazelTarget{
name: "sh_binary_target",
ruleClass: "sh_binary",
// Note: no bzlLoadLocation for native rules
// TODO(ruperts): Could open source the existing, experimental Starlark sh_ rules?
},
},
expectedLoadStatements: `load("//build/bazel/rules:cc.bzl", "cc_binary")
load("//build/bazel/rules:java.bzl", "java_binary")`,
@@ -860,23 +853,6 @@ genrule {
)`,
},
},
{
description: "sh_binary test",
moduleTypeUnderTest: "sh_binary",
moduleTypeUnderTestFactory: sh.ShBinaryFactory,
moduleTypeUnderTestBp2BuildMutator: sh.ShBinaryBp2Build,
bp: `sh_binary {
name: "foo",
src: "foo.sh",
bazel_module: { bp2build_available: true },
}`,
expectedBazelTargets: []string{`sh_binary(
name = "foo",
srcs = [
"foo.sh",
],
)`},
},
}
dir := "."