Skip to content

Commit

Permalink
Update unit tests to account for csv output. Update makefile to inclu…
Browse files Browse the repository at this point in the history
…de unit test functionality for main marshal/unmarhsal functions.
  • Loading branch information
JFryy committed Oct 20, 2024
1 parent 6d17dcb commit c3bc2dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build:

test: build
./tests/test.sh
go test ./codec

clean:
rm bin/$(BINARY)
Expand Down
9 changes: 8 additions & 1 deletion codec/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ func TestMarshal(t *testing.T) {
}

for _, tt := range tests {
_, err := Marshal(data, tt.encodingType)
// wrap in an interface for things like CSV that require the basic test data be a []map[string]interface{}
var currentData interface{}
currentData = data
if tt.encodingType == CSV {
currentData = []interface{}{data}
}

_, err := Marshal(currentData, tt.encodingType)
if err != nil {
t.Errorf("marshal failed for %v: %v", tt.encodingType, err)
}
Expand Down

0 comments on commit c3bc2dd

Please sign in to comment.