-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprod_extra.go
42 lines (35 loc) · 1.2 KB
/
prod_extra.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
//go:build !assert
package assert
import "sync"
// A TryLocker represents an object that can attempt to acquire a lock and report
// whether it succeeded.
//
// [sync.Mutex] and [sync.RWMutex] implements this interface.
type TryLocker interface {
sync.Locker
TryLock() bool
}
// Locked asserts that the [TryLocker] is already locked.
//
// assert.IsDecreasing([]int{2, 1, 0})
// assert.IsDecreasing([]float{2, 1})
// assert.IsDecreasing([]string{"b", "a"})
func Locked(locker TryLocker, msgAndArgs ...any) {}
// Lockedf asserts that the [TryLocker] is already locked.
//
// assert.IsDecreasing([]int{2, 1, 0})
// assert.IsDecreasing([]float{2, 1})
// assert.IsDecreasing([]string{"b", "a"})
func Lockedf(locker TryLocker, msg string, args ...any) {}
// Unlocked asserts that the [TryLocker] is unlocked.
//
// assert.IsDecreasing([]int{2, 1, 0})
// assert.IsDecreasing([]float{2, 1})
// assert.IsDecreasing([]string{"b", "a"})
func Unlocked(locker TryLocker, msgAndArgs ...any) {}
// UnLockedf asserts that the [TryLocker] is unlocked.
//
// assert.IsDecreasing([]int{2, 1, 0})
// assert.IsDecreasing([]float{2, 1})
// assert.IsDecreasing([]string{"b", "a"})
func Unlockedf(locker TryLocker, msg string, args ...any) {}