blob: d3bdaab55537b849ccedb5fee192c8a716cc3473 [file] [log] [blame]
40 columns |
>>> long single-line
"this string is longer than forty characters";
<<<
"this string is longer than forty characters";
>>> short one line multi-line
"""not too long""";
<<<
"""not too long""";
>>> multi-line with short lines
"""
not too long
or this one
""";
<<<
"""
not too long
or this one
""";
>>> multi-line with long lines
"""
this string is longer than forty characters
this one is also is longer than forty characters
""";
<<<
"""
this string is longer than forty characters
this one is also is longer than forty characters
""";
>>> only indent the first line of multiline strings
{
"""
multiline
""";
}
<<<
{
"""
multiline
""";
}
>>> do not wrap the first line if not needed
someMethod("""first line fits in here
more stuff down here too that is long
""");
<<<
someMethod("""first line fits in here
more stuff down here too that is long
""");
>>> wrap first line if needed
someMethod("""first line does not fits here
""");
<<<
someMethod(
"""first line does not fits here
""");
>>> format multiline as a block with a leading argument
someMethod("foo", """
some
text
""");
<<<
someMethod("foo", """
some
text
""");
>>> format multiline as a block with a trailing argument
someMethod("""
some
text
""", "foo");
<<<
someMethod("""
some
text
""", "foo");
>>> format multiline as a block with leading and trailing arguments
someMethod(
"foo",
"""
some
text
""",
"foo");
<<<
someMethod(
"foo",
"""
some
text
""",
"foo");
>>> format multiple multilines as blocks
someMethod("""
some
text
""", """
some
more
""", """
even more
""");
<<<
someMethod("""
some
text
""", """
some
more
""", """
even more
""");
>>> format multilines with other blocks as blocks
someMethod("""
some
text
""", () {
some;
function;
}, [
"some",
"collection",
"with",
"many",
"elements"
]);
<<<
someMethod("""
some
text
""", () {
some;
function;
}, [
"some",
"collection",
"with",
"many",
"elements"
]);
>>> interpolation is not split even when line is too long
someMethod("some text that is pretty long ${ interpolate +
a + thing } more text");
<<<
someMethod(
"some text that is pretty long ${interpolate + a + thing} more text");
>>> multi-line string interpolation does not split
someMethod("foo", """
some text that is pretty long
some more text that is pretty long ${ interpolate + a + thing } more text
""");
<<<
someMethod("foo", """
some text that is pretty long
some more text that is pretty long ${interpolate + a + thing} more text
""");
>>> nested interpolation is not split
someMethod("some text that is ${pretty + 'long ${ interpolate +
a + thing } more'} text", "another arg");
<<<
someMethod(
"some text that is ${pretty + 'long ${interpolate + a + thing} more'} text",
"another arg");
>>> hard splits are not split in interpolation
someMethod("before ${(){statement();statement();statement();}} after");
<<<
someMethod(
"before ${() { statement(); statement(); statement(); }} after");