File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -404,19 +404,13 @@ func blockStringValue(in string) string {
404404 }
405405
406406 // Remove leading blank lines.
407- for {
408- if isBlank := lineIsBlank (lines [0 ]); ! isBlank {
409- break
410- }
407+ for len (lines ) > 0 && lineIsBlank (lines [0 ]) {
411408 lines = lines [1 :]
412409 }
413410
414411 // Remove trailing blank lines.
415- for {
412+ for len ( lines ) > 0 && lineIsBlank ( lines [ len ( lines ) - 1 ]) {
416413 i := len (lines ) - 1
417- if isBlank := lineIsBlank (lines [i ]); ! isBlank {
418- break
419- }
420414 lines = append (lines [:i ], lines [i + 1 :]... )
421415 }
422416
Original file line number Diff line number Diff line change @@ -449,6 +449,15 @@ func TestLexer_ReportsUsefulStringErrors(t *testing.T) {
449449
450450func TestLexer_LexesBlockStrings (t * testing.T ) {
451451 tests := []Test {
452+ {
453+ Body : `""""""` ,
454+ Expected : Token {
455+ Kind : BLOCK_STRING ,
456+ Start : 0 ,
457+ End : 6 ,
458+ Value : "" ,
459+ },
460+ },
452461 {
453462 Body : `"""simple"""` ,
454463 Expected : Token {
You can’t perform that action at this time.
0 commit comments