From e731c602e1366b953b3770a0539bc983fcf0672c Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Mon, 7 Oct 2024 15:15:24 +0200 Subject: [PATCH] add unit test for sensors.TemperaturesWithContext --- sensors/sensors_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sensors/sensors_test.go b/sensors/sensors_test.go index 454316a9c..ff13867b2 100644 --- a/sensors/sensors_test.go +++ b/sensors/sensors_test.go @@ -3,8 +3,11 @@ package sensors import ( + "context" "fmt" "testing" + + "github.com/shirou/gopsutil/v4/sensors" ) func TestTemperatureStat_String(t *testing.T) { @@ -19,3 +22,8 @@ func TestTemperatureStat_String(t *testing.T) { t.Errorf("TemperatureStat string is invalid, %v", fmt.Sprintf("%v", v)) } } + +func TestTemperatures(t *testing.T) { + // make sure it does not segfault + sensors.TemperaturesWithContext(context.TODO()) +}