-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
fso_test.go
42 lines (39 loc) · 935 Bytes
/
fso_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"testing"
"github.com/oalders/is/ops"
"github.com/oalders/is/types"
"github.com/stretchr/testify/assert"
)
func TestFSOLastModifiedTime(t *testing.T) {
t.Parallel()
const tmux = "testdata/bin/tmux"
{
ctx := types.Context{Debug: true}
cmd := FSOCmd{Age: AgeCmp{tmux, ops.Gt, "1", "s"}}
err := cmd.Run(&ctx)
assert.NoError(t, err)
assert.True(t, ctx.Success)
}
{
ctx := types.Context{Debug: true}
cmd := FSOCmd{Age: AgeCmp{tmux, ops.Lt, "100000", "days"}}
err := cmd.Run(&ctx)
assert.NoError(t, err)
assert.True(t, ctx.Success)
}
{
ctx := types.Context{Debug: true}
cmd := FSOCmd{Age: AgeCmp{tmux, ops.Lt, "1.1", "d"}}
err := cmd.Run(&ctx)
assert.Error(t, err)
assert.False(t, ctx.Success)
}
{
ctx := types.Context{Debug: true}
cmd := FSOCmd{Age: AgeCmp{"tmuxxx", ops.Lt, "1", "d"}}
err := cmd.Run(&ctx)
assert.Error(t, err)
assert.False(t, ctx.Success)
}
}