2022-02-25 03:25:04 +00:00
|
|
|
package check_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2022-02-25 05:29:55 +00:00
|
|
|
"reflect"
|
2022-02-25 03:25:04 +00:00
|
|
|
|
|
|
|
"github.com/rwxrob/bonzai/check"
|
|
|
|
)
|
|
|
|
|
2022-02-25 05:29:55 +00:00
|
|
|
func ExampleIsNil() {
|
|
|
|
var names []string
|
|
|
|
var namesi interface{}
|
|
|
|
namesi = names
|
|
|
|
fmt.Println(names == nil)
|
|
|
|
fmt.Println(namesi == nil)
|
|
|
|
fmt.Println(reflect.ValueOf(namesi).IsNil())
|
|
|
|
fmt.Println(check.IsNil(namesi))
|
|
|
|
// Output:
|
|
|
|
// true
|
|
|
|
// false
|
|
|
|
// true
|
|
|
|
// true
|
|
|
|
}
|
2022-02-26 04:28:43 +00:00
|
|
|
|
|
|
|
func ExampleIsDir() {
|
|
|
|
fmt.Println(check.IsDir("testdata"))
|
|
|
|
fmt.Println(check.IsDir("nothing"))
|
|
|
|
// Output:
|
|
|
|
// true
|
|
|
|
// false
|
|
|
|
}
|