From 38528eb67174b6b877efe0a2d90986522afa0871 Mon Sep 17 00:00:00 2001 From: Terence Boldt Date: Tue, 27 Dec 2022 17:20:28 -0500 Subject: [PATCH] Fix text to BASIC when line feed after token --- prodos/basic.go | 2 +- prodos/basic_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/prodos/basic.go b/prodos/basic.go index c06e47b..953d784 100644 --- a/prodos/basic.go +++ b/prodos/basic.go @@ -200,7 +200,7 @@ func ConvertTextToBasic(text string) ([]byte, error) { } } - if skipChars > 0 { + if skipChars > 0 && c != '\n' { skipChars-- continue } diff --git a/prodos/basic_test.go b/prodos/basic_test.go index 06d32f8..55d95b4 100644 --- a/prodos/basic_test.go +++ b/prodos/basic_test.go @@ -25,7 +25,7 @@ func TestConvertBasicToText(t *testing.T) { t.Run(testname, func(t *testing.T) { text := ConvertBasicToText(tt.basic) if text != tt.want { - t.Errorf("\ngot '%#v'\nwant '%#v'\n", []byte(text), []byte(tt.want)) + t.Errorf("%s\ngot '%#v'\nwant '%#v'\n", testname, []byte(text), []byte(tt.want)) } }) } @@ -69,7 +69,7 @@ func TestConvertTextToBasic(t *testing.T) { t.Run(testname, func(t *testing.T) { basic, _ := ConvertTextToBasic(tt.basicText) if bytes.Compare(basic, tt.want) != 0 { - t.Errorf("\ngot '%#v'\nwant '%#v'\n", basic, tt.want) + t.Errorf("%s\ngot '%#v'\nwant '%#v'\n", testname, basic, tt.want) } }) }