negative wait WIP

This commit is contained in:
Matthew Hooker 2018-04-16 13:37:17 -07:00
parent add7e8acb9
commit 9a8acbbcab
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
2 changed files with 21 additions and 0 deletions

View File

@ -84,6 +84,12 @@ type waitExpression struct {
// Do waits the amount of time described by the expression. It is cancellable
// through the context.
func (w *waitExpression) Do(ctx context.Context, _ BCDriver) error {
/*
// do I want this to not parse or to error?
if w.d < 0 {
panic("Was not expecting negative wait duration.")
}
*/
log.Printf("[INFO] Waiting %s", w.d)
select {
case <-time.After(w.d):

View File

@ -99,3 +99,18 @@ func Test_special(t *testing.T) {
}
}
}
func Test_negativeWait(t *testing.T) {
in := "<wait-1m>"
_, err := ParseReader("", strings.NewReader(in))
if err != nil {
log.Fatal(err)
}
/*
gL := toIfaceSlice(got)
for _, g := range gL {
assert.Equal(t, tt.out, g.(*specialExpression).String())
}
*/
}