mirror of
https://gitee.com/johng/gf
synced 2026-07-08 22:40:30 +08:00
fix issue in gres.UnpackContent; fix issue in gtime.NewFromTimeStamp
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
package gres_test
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/os/gtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@ -17,7 +18,7 @@ import (
|
||||
"github.com/gogf/gf/test/gtest"
|
||||
)
|
||||
|
||||
func Test_Pack(t *testing.T) {
|
||||
func Test_PackToGoFile(t *testing.T) {
|
||||
gtest.Case(t, func() {
|
||||
srcPath := gdebug.CallerDirectory() + "/testdata/files"
|
||||
goFilePath := gdebug.CallerDirectory() + "/testdata/testdata.go"
|
||||
@ -27,6 +28,35 @@ func Test_Pack(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func Test_Pack(t *testing.T) {
|
||||
gtest.Case(t, func() {
|
||||
srcPath := gdebug.CallerDirectory() + "/testdata/files"
|
||||
data, err := gres.Pack(srcPath)
|
||||
gtest.Assert(err, nil)
|
||||
|
||||
r := gres.New()
|
||||
err = r.Add(string(data))
|
||||
gtest.Assert(err, nil)
|
||||
gtest.Assert(r.Contains("files"), true)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_PackToFile(t *testing.T) {
|
||||
gtest.Case(t, func() {
|
||||
srcPath := gdebug.CallerDirectory() + "/testdata/files"
|
||||
dstPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr())
|
||||
err := gres.PackToFile(srcPath, dstPath)
|
||||
gtest.Assert(err, nil)
|
||||
|
||||
defer gfile.Remove(dstPath)
|
||||
|
||||
r := gres.New()
|
||||
err = r.Load(dstPath)
|
||||
gtest.Assert(err, nil)
|
||||
gtest.Assert(r.Contains("files"), true)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_PackMulti(t *testing.T) {
|
||||
gtest.Case(t, func() {
|
||||
srcPath := gdebug.CallerDirectory() + "/testdata/files"
|
||||
|
||||
Reference in New Issue
Block a user