diff --git a/platforms/beaglebone/beaglebone_adaptor_test.go b/platforms/beaglebone/beaglebone_adaptor_test.go index 848a2428..3ce44ad4 100644 --- a/platforms/beaglebone/beaglebone_adaptor_test.go +++ b/platforms/beaglebone/beaglebone_adaptor_test.go @@ -113,11 +113,11 @@ func TestBeagleboneAdaptor(t *testing.T) { gobottest.Assert(t, a.ServoWrite("P9_99", 175), errors.New("Not a valid PWM pin")) fs.WithReadError = true - gobottest.Assert(t, a.PwmWrite("P9_21", 175), errors.New("read error")) + gobottest.Assert(t, strings.Contains(a.PwmWrite("P9_21", 175).Error(), "read error"), true) fs.WithReadError = false fs.WithWriteError = true - gobottest.Assert(t, a.PwmWrite("P9_22", 175), errors.New("write error")) + gobottest.Assert(t, strings.Contains(a.PwmWrite("P9_22", 175).Error(), "write error"), true) fs.WithWriteError = false // Analog diff --git a/platforms/chip/chip_adaptor_test.go b/platforms/chip/chip_adaptor_test.go index 05617bfd..be6449fd 100644 --- a/platforms/chip/chip_adaptor_test.go +++ b/platforms/chip/chip_adaptor_test.go @@ -208,7 +208,7 @@ func TestAdaptorPwmWriteError(t *testing.T) { fs.WithWriteError = true err := a.PwmWrite("PWM0", 100) - gobottest.Assert(t, err, errors.New("write error")) + gobottest.Assert(t, strings.Contains(err.Error(), "write error"), true) } func TestAdaptorPwmReadError(t *testing.T) { @@ -216,7 +216,7 @@ func TestAdaptorPwmReadError(t *testing.T) { fs.WithReadError = true err := a.PwmWrite("PWM0", 100) - gobottest.Assert(t, err, errors.New("read error")) + gobottest.Assert(t, strings.Contains(err.Error(), "read error"), true) } func TestChipDefaultBus(t *testing.T) { diff --git a/platforms/intel-iot/edison/edison_adaptor_test.go b/platforms/intel-iot/edison/edison_adaptor_test.go index a4be12d0..e4555fab 100644 --- a/platforms/intel-iot/edison/edison_adaptor_test.go +++ b/platforms/intel-iot/edison/edison_adaptor_test.go @@ -479,7 +479,7 @@ func TestAdaptorPwmWriteError(t *testing.T) { fs.WithWriteError = true err := a.PwmWrite("5", 100) - gobottest.Assert(t, err, errors.New("write error")) + gobottest.Assert(t, strings.Contains(err.Error(), "write error"), true) } func TestAdaptorPwmReadError(t *testing.T) { @@ -488,7 +488,7 @@ func TestAdaptorPwmReadError(t *testing.T) { fs.WithReadError = true err := a.PwmWrite("5", 100) - gobottest.Assert(t, err, errors.New("read error")) + gobottest.Assert(t, strings.Contains(err.Error(), "read error"), true) } func TestAdaptorAnalog(t *testing.T) { diff --git a/platforms/upboard/up2/adaptor_test.go b/platforms/upboard/up2/adaptor_test.go index b448d953..3bcba7d0 100644 --- a/platforms/upboard/up2/adaptor_test.go +++ b/platforms/upboard/up2/adaptor_test.go @@ -169,7 +169,7 @@ func TestUP2AdaptorPwmWriteError(t *testing.T) { fs.WithWriteError = true err := a.PwmWrite("32", 100) - gobottest.Assert(t, err, errors.New("write error")) + gobottest.Assert(t, strings.Contains(err.Error(), "write error"), true) } func TestUP2AdaptorPwmReadError(t *testing.T) { @@ -177,7 +177,7 @@ func TestUP2AdaptorPwmReadError(t *testing.T) { fs.WithReadError = true err := a.PwmWrite("32", 100) - gobottest.Assert(t, err, errors.New("read error")) + gobottest.Assert(t, strings.Contains(err.Error(), "read error"), true) } func TestUP2I2CDefaultBus(t *testing.T) {