Skip to content

Commit 4221393

Browse files
committed
Add timed exeuction test
1 parent bf0c2f9 commit 4221393

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

commands/run_test.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
package commands
22

3-
import "testing"
3+
import (
4+
"github.com/stretchr/testify/assert"
5+
"os/exec"
6+
"testing"
7+
)
48

5-
func TestNothing(t *testing.T) {
6-
// NO-OP
9+
func TestTimedOutExecution(t *testing.T) {
10+
cmd := exec.Command("sleep", "1")
11+
status, err := timedExecution(cmd, 999.99)
12+
assert.Equal(t, err, nil)
13+
assert.Equal(t, status, TO)
14+
}
15+
16+
func TestTimedExecution(t *testing.T) {
17+
cmd := exec.Command("sleep", "1")
18+
status, err := timedExecution(cmd, 1250)
19+
assert.Equal(t, err, nil)
20+
assert.Equal(t, status, OK)
721
}

0 commit comments

Comments
 (0)