summaryrefslogtreecommitdiffstats
path: root/devices/temp_darwin_test.go
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2021-05-03 11:43:13 -0500
committerSean E. Russell <ser@ser1.net>2021-05-03 11:43:13 -0500
commit162ed50189ea602c857738789f5a8dd4adb11180 (patch)
tree2be775575b881213e00dc446b09dc18aa3727a83 /devices/temp_darwin_test.go
parente3cd3ebe5e960896b9515df054cea75df6ce2c89 (diff)
parent5a063376b0d63bfe57f35169dc1c754d3f7d16b0 (diff)
Merge branch 'go1.16'
Diffstat (limited to 'devices/temp_darwin_test.go')
-rw-r--r--devices/temp_darwin_test.go23
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