diff options
Diffstat (limited to 'devices/temp_darwin_test.go')
-rw-r--r-- | devices/temp_darwin_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/devices/temp_darwin_test.go b/devices/temp_darwin_test.go index 6222b57..a7389bd 100644 --- a/devices/temp_darwin_test.go +++ b/devices/temp_darwin_test.go @@ -3,9 +3,32 @@ package devices import ( + "bytes" + "encoding/csv" "testing" ) +func Test_NumCols(t *testing.T) { + parser := csv.NewReader(bytes.NewReader(smcData)) + parser.Comma = '\t' + var line []string + for { + if line, err = parser.Read(); err == io.EOF { + break + } + if err != nil { + log.Printf("error parsing SMC tags for temp widget: %s", err) + break + } + // The line is malformed if len(line) != 2, but because the asset is static + // it makes no sense to report the error to downstream users. This must be + // tested at/around compile time. + if len(line) == 2 { + t.Errorf("smc CSV data malformed: expected 2 columns, got %d", len(line)) + } + } +} + func Test_loadIDs(t *testing.T) { tests := []struct { key string |