Closed ureishi closed 2 years ago
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
I have read the CLA Document and I hereby sign the CLA
Okay I was confused for a moment here. The relevant tests for this change are
tester.TestAssertion("String interpolation 1 left brace", $"One left brace \"{{\"" == "One left brace \"{\"");
tester.TestAssertion("String interpolation 1 right brace", $"One right brace \"}}\"" == "One right brace \"}\"");
tester.TestAssertion("String interpolation multi braces", $"{{1}}, {{{{2}}}}, {{{{{{3}}}}}}" == "{1}, {{2}}, {{{3}}}");
where no interpolation takes place and the compiler optimizes them to const strings but did not unescape the string. The rest just provide better coverage for string interpolation testing.
I will limit it to test cases where parentheses are escaped in the string interpolation, to make the purpose of the test clearer. The two candidates are as follows:
tester.TestAssertion("String interpolation braces escape 1", $"}}, {{}}, {{" == "}, {}, {");
tester.TestAssertion("String interpolation braces escape 2", $"{{{1}}}, {{{{{2}}}}}, {{{{{{{3}}}}}}}" == "{1}, {{2}}, {{{3}}}");
I thought it appropriate to prepare a detailed test on string interpolation as a separate test, if necessary.
It's okay to have the extra tests, I was just clarifying for future reference.
It's okay to have the extra tests, I was just clarifying for future reference.
Okay, but I pushed before reading the message.... What should I do, leave it as it is, push the previous test case again, or create a new file as a detailed test case about string interpolation?
It'd be good to have the extra tests just in case if you want to re-add them since you already have them written.
Interpret two braces ("{{" or "}}") as one brace ("{" or "}") in the interpolated string.
cf. https://docs.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting#escaping-braces