1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00

firmata: client tests don't need so many goroutines

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-05-11 16:26:54 +02:00
parent 3c4a4f6e0d
commit efee462c95

View File

@ -133,11 +133,11 @@ func TestProcessProtocolVersion(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("ProtocolVersion was not published") t.Errorf("ProtocolVersion was not published")
} }
} }
@ -153,11 +153,11 @@ func TestProcessAnalogRead0(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("AnalogRead0 was not published") t.Errorf("AnalogRead0 was not published")
} }
} }
@ -173,11 +173,11 @@ func TestProcessAnalogRead1(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("AnalogRead1 was not published") t.Errorf("AnalogRead1 was not published")
} }
} }
@ -194,11 +194,11 @@ func TestProcessDigitalRead2(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("DigitalRead2 was not published") t.Errorf("DigitalRead2 was not published")
} }
} }
@ -215,11 +215,11 @@ func TestProcessDigitalRead4(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("DigitalRead4 was not published") t.Errorf("DigitalRead4 was not published")
} }
} }
@ -260,11 +260,11 @@ func TestProcessPinState13(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("PinState13 was not published") t.Errorf("PinState13 was not published")
} }
} }
@ -284,11 +284,11 @@ func TestProcessI2cReply(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("I2cReply was not published") t.Errorf("I2cReply was not published")
} }
} }
@ -306,11 +306,11 @@ func TestProcessFirmwareQuery(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("FirmwareQuery was not published") t.Errorf("FirmwareQuery was not published")
} }
} }
@ -326,11 +326,11 @@ func TestProcessStringData(t *testing.T) {
sem <- true sem <- true
}) })
go b.process() b.process()
select { select {
case <-sem: case <-sem:
case <-time.After(20 * time.Millisecond): case <-time.After(100 * time.Millisecond):
t.Errorf("StringData was not published") t.Errorf("StringData was not published")
} }
} }