summaryrefslogtreecommitdiff
path: root/bp2build/python_binary_conversion_test.go
diff options
context:
space:
mode:
authorJingwen Chen <jingwen@google.com>2021-04-08 14:40:57 +0000
committerJingwen Chen <jingwen@google.com>2021-04-09 09:42:57 +0000
commitb4628eb03fe28b3f1f1a97bb0d8d9a1944eb001d (patch)
treee22176af24105cfa8e6ae95d5181c0317bc7bdbc /bp2build/python_binary_conversion_test.go
parent6393098ecfd94c08e4e6f405227bda792413a7c2 (diff)
bp2build: codegen singleton lists on one line.
This CL refactors the bp2build code generator to pretty print lists with a single element on one line, instead of taking up three lines, which can make BUILD files unnecessarily long. A single line singleton list is also more commonly used in BUILD files. Test: TH Change-Id: Ic9e44741bbb070c8f45925466b9ccdd0608498b2
Diffstat (limited to 'bp2build/python_binary_conversion_test.go')
-rw-r--r--bp2build/python_binary_conversion_test.go25
1 files changed, 6 insertions, 19 deletions
diff --git a/bp2build/python_binary_conversion_test.go b/bp2build/python_binary_conversion_test.go
index 7600e3651..2054e0678 100644
--- a/bp2build/python_binary_conversion_test.go
+++ b/bp2build/python_binary_conversion_test.go
@@ -33,24 +33,15 @@ func TestPythonBinaryHost(t *testing.T) {
blueprint: `python_binary_host {
name: "foo",
main: "a.py",
- srcs: [
- "**/*.py"
- ],
- exclude_srcs: [
- "b/e.py"
- ],
- data: [
- "files/data.txt",
- ],
-
+ srcs: ["**/*.py"],
+ exclude_srcs: ["b/e.py"],
+ data: ["files/data.txt",],
bazel_module: { bp2build_available: true },
}
`,
expectedBazelTargets: []string{`py_binary(
name = "foo",
- data = [
- "files/data.txt",
- ],
+ data = ["files/data.txt"],
main = "a.py",
srcs = [
"a.py",
@@ -83,9 +74,7 @@ func TestPythonBinaryHost(t *testing.T) {
expectedBazelTargets: []string{`py_binary(
name = "foo",
python_version = "PY2",
- srcs = [
- "a.py",
- ],
+ srcs = ["a.py"],
)`,
},
},
@@ -113,9 +102,7 @@ func TestPythonBinaryHost(t *testing.T) {
// python_version is PY3 by default.
`py_binary(
name = "foo",
- srcs = [
- "a.py",
- ],
+ srcs = ["a.py"],
)`,
},
},