Skip to content

Commit

Permalink
Fix dropping one character text block lines
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Feb 21, 2020
1 parent 1bacd66 commit d4003a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,6 @@ private static String createTextBlockLine(String line, int longestPadding) {
endPosition--;
}

return endPosition > startPosition ? line.substring(startPosition, endPosition + 1) : null;
return endPosition >= startPosition ? line.substring(startPosition, endPosition + 1) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ private static Stream<Arguments> validTextProvider() {
Arguments.of("\"\\ud83d\\ude00\"", "\uD83D\uDE00"),

// Text blocks
Arguments.of("\"\"\"\nf\"\"\"", "f"),
Arguments.of("\"\"\"\nfoo\"\"\"", "foo"),
Arguments.of("\"\"\"\nfoo\\\"\"\"\"", "foo\""),
Arguments.of("\"\"\"\nf\n foo\n\"\"\"", "f\n foo\n"),
Arguments.of("\"\"\"\n f\n foo\n\"\"\"", "f\n foo\n"),
Arguments.of("\"\"\"\n foo\nf\n\"\"\"", " foo\nf\n"),
Arguments.of("\"\"\"\n foo\n f\n\"\"\"", " foo\nf\n"),
Arguments.of("\"\"\"\n foo\n baz\"\"\"", "foo\nbaz"),
Arguments.of("\"\"\"\n\n\n\"\"\"", "\n\n"),
Arguments.of("\"\"\"\n foo\n baz\n \"\"\"", "foo\nbaz\n"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"com.example#U": {
"type": "string",
"traits": {
"smithy.api#documentation": "This is a\nstring defined on multiple lines.\nIt can span\n\ngreat\nmany\nlines."
"smithy.api#documentation": "This is a\nstring defined on multiple lines.\nIt can span\na\ngreat\nmany\nlines."
}
},
"com.example#numeric": {
Expand Down

0 comments on commit d4003a5

Please sign in to comment.