New example files: entitlement, task, lock, log, drive, config, command, info. Every major source file now has a dedicated *_example_test.go with compilable, tested examples. 561 tests, 84.8% coverage. Co-Authored-By: Virgil <virgil@lethean.io>
19 lines
251 B
Go
19 lines
251 B
Go
package core_test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
. "dappco.re/go/core"
|
|
)
|
|
|
|
func ExampleCore_Lock() {
|
|
c := New()
|
|
lock := c.Lock("drain")
|
|
lock.Mutex.Lock()
|
|
fmt.Println("locked")
|
|
lock.Mutex.Unlock()
|
|
fmt.Println("unlocked")
|
|
// Output:
|
|
// locked
|
|
// unlocked
|
|
}
|