mirror of
https://github.com/rwxrob/bonzai
synced 2024-11-18 15:25:45 +00:00
32 lines
484 B
Go
32 lines
484 B
Go
package check_test
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
|
|
"github.com/rwxrob/bonzai/check"
|
|
)
|
|
|
|
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
|
|
}
|
|
|
|
func ExampleIsDir() {
|
|
fmt.Println(check.IsDir("testdata"))
|
|
fmt.Println(check.IsDir("nothing"))
|
|
// Output:
|
|
// true
|
|
// false
|
|
}
|