file_test.go 603 B

123456789101112131415161718192021222324252627
  1. package file
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestFileFunc(t *testing.T) {
  7. fPath := "/home/anyuan/下载/php2go-1.0.0/go.mod"
  8. fmt.Println("Basename: ", Basename(fPath))
  9. fmt.Println("Dirname: ", Dirname(fPath))
  10. fmt.Println("Filesize: ", Filesize(fPath))
  11. fInfo, err := PathInfo(fPath)
  12. fmt.Println("PathInfo: ", fInfo, err)
  13. fmt.Println("FileExists: ", FileExists(fPath))
  14. fPathDir := "/home/anyuan/下载/php2go-1.0.0/"
  15. fmt.Println("IsDir - IsFile: ", IsDir(fPathDir), IsFile(fPathDir))
  16. fmt.Println("IsFile - IsDir: ", IsFile(fPath), IsDir(fPath))
  17. fmt.Println(FileGetContents(fPath))
  18. }