bp2build/queryview: codegen control sequences literally.

See b/184026959 for an instance where a genrule's cmd contains \n, and
the codegenerator generates an applied newline. It should be the
original newline control sequence literal.

Test: TH, bp2build unit test
Fixes: 184026959

Change-Id: Idb99ea87c75dfa4cb3ae679f98d8f61cb5a5ab09
This commit is contained in:
Jingwen Chen
2021-03-30 13:08:36 +00:00
parent cf7f2e0a9e
commit 58a12b8bae
2 changed files with 23 additions and 0 deletions

View File

@@ -239,6 +239,22 @@ func TestGenerateBazelTargetModules(t *testing.T) {
"b",
],
string_prop = "a",
)`,
},
{
bp: `custom {
name: "control_characters",
string_list_prop: ["\t", "\n"],
string_prop: "a\t\n\r",
bazel_module: { bp2build_available: true },
}`,
expectedBazelTarget: `custom(
name = "control_characters",
string_list_prop = [
"\t",
"\n",
],
string_prop = "a\t\n\r",
)`,
},
}