Exemplo n.º 1
0
// Match os.FileInfo values that specify a file birth time within the supplied
// radius of the given time. On platforms where there is no birth time
// available, match all os.FileInfo values.
func BirthtimeIsWithin(
	expected time.Time,
	d time.Duration) oglematchers.Matcher {
	return oglematchers.NewMatcher(
		func(c interface{}) error { return birthtimeIsWithin(c, expected, d) },
		fmt.Sprintf("birthtime is within %v of %v", d, expected))
}
Exemplo n.º 2
0
// Return a matcher for times that are exactly equal to the given input time.
func TimeEq(t time.Time) oglematchers.Matcher {
	return oglematchers.NewMatcher(
		func(c interface{}) error { return timeEq(t, c) },
		t.String())
}
Exemplo n.º 3
0
// Return a matcher for times whose absolute distance from t is less than d.
func TimeNear(t time.Time, d time.Duration) oglematchers.Matcher {
	return oglematchers.NewMatcher(
		func(c interface{}) error { return timeNear(t, d, c) },
		fmt.Sprintf("within %v of %v", d, t))
}
Exemplo n.º 4
0
// Match os.FileInfo values that specify an mtime equal to the given time.
func MtimeIs(expected time.Time) oglematchers.Matcher {
	return oglematchers.NewMatcher(
		func(c interface{}) error { return mtimeIsWithin(c, expected, 0) },
		fmt.Sprintf("mtime is %v", expected))
}
Exemplo n.º 5
0
// Match os.FileInfo values that specify a number of links equal to the given
// number. On platforms where there is no nlink field available, match all
// os.FileInfo values.
func NlinkIs(expected uint64) oglematchers.Matcher {
	return oglematchers.NewMatcher(
		func(c interface{}) error { return nlinkIs(c, expected) },
		fmt.Sprintf("nlink is %v", expected))
}
Exemplo n.º 6
0
// Match os.FileInfo values that specify a file birth time equal to the given
// time. On platforms where there is no birth time available, match all
// os.FileInfo values.
func BirthtimeIs(expected time.Time) oglematchers.Matcher {
	return oglematchers.NewMatcher(
		func(c interface{}) error { return birthtimeIs(c, expected) },
		fmt.Sprintf("birthtime is %v", expected))
}