Skip to content

Commit

Permalink
ADX: output a newline at the end of the file
Browse files Browse the repository at this point in the history
  • Loading branch information
flwyd committed Sep 18, 2024
1 parent ae539ef commit 7204c40
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions adif/adx.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,8 @@ func (o *ADXIO) Write(l *Logfile, out io.Writer) error {
if err := e.EncodeElement(&f, start); err != nil {
return fmt.Errorf("error writing ADX file %s: %w", l.Filename, err)
}
if _, err := out.Write([]byte("\n")); err != nil {
return fmt.Errorf("error writing ADX file %s: %w", l.Filename, err)
}
return nil
}
3 changes: 2 additions & 1 deletion adif/adx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ Inverted L antenna, 70' above ground
</RECORD>
</RECORDS>
<!--The <last> word.-->
</ADX>`
</ADX>
`
adx := NewADXIO()
adx.Indent = 2
out := &strings.Builder{}
Expand Down
3 changes: 2 additions & 1 deletion cmd/save_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Comment about Santa on the Air <CALL:3>N0P <QSO_DATE:8>20221224 <BAND:2>2m <EOR>
{
name: "infer ADX",
filename: "out.adx",
want: xml.Header + `<ADX><HEADER><!--Test comment--><ADIF_VER>3.1.4</ADIF_VER><PROGRAMID>test save</PROGRAMID><PROGRAMVERSION>5.6.7</PROGRAMVERSION></HEADER><RECORDS><RECORD><CALL>W1AW</CALL><QSO_DATE>19870605</QSO_DATE><BAND>40m</BAND></RECORD><RECORD><!--Comment about Santa on the Air--><CALL>N0P</CALL><QSO_DATE>20221224</QSO_DATE><BAND>2m</BAND></RECORD></RECORDS></ADX>`,
want: xml.Header + `<ADX><HEADER><!--Test comment--><ADIF_VER>3.1.4</ADIF_VER><PROGRAMID>test save</PROGRAMID><PROGRAMVERSION>5.6.7</PROGRAMVERSION></HEADER><RECORDS><RECORD><CALL>W1AW</CALL><QSO_DATE>19870605</QSO_DATE><BAND>40m</BAND></RECORD><RECORD><!--Comment about Santa on the Air--><CALL>N0P</CALL><QSO_DATE>20221224</QSO_DATE><BAND>2m</BAND></RECORD></RECORDS></ADX>
`,
},
{
name: "infer CSV",
Expand Down

0 comments on commit 7204c40

Please sign in to comment.