Skip to content

Commit

Permalink
core: should correct occasional test errors due to event overlap with…
Browse files Browse the repository at this point in the history
… test

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Sep 12, 2016
1 parent 0c6bd6d commit a383f59
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions platforms/gpio/button_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,32 @@ func TestButtonDriverStart(t *testing.T) {
d := initTestButtonDriver()
gobottest.Assert(t, len(d.Start()), 0)

testAdaptorDigitalRead = func() (val int, err error) {
val = 1
return
}

d.Once(ButtonPush, func(data interface{}) {
gobottest.Assert(t, d.Active, true)
sem <- true
})

testAdaptorDigitalRead = func() (val int, err error) {
val = 1
return
}

select {
case <-sem:
case <-time.After(BUTTON_TEST_DELAY * time.Millisecond):
t.Errorf("Button Event \"Push\" was not published")
}

testAdaptorDigitalRead = func() (val int, err error) {
val = 0
return
}

d.Once(ButtonRelease, func(data interface{}) {
gobottest.Assert(t, d.Active, false)
sem <- true
})

testAdaptorDigitalRead = func() (val int, err error) {
val = 0
return
}

select {
case <-sem:
case <-time.After(BUTTON_TEST_DELAY * time.Millisecond):
Expand Down

0 comments on commit a383f59

Please sign in to comment.