fix issue in gres.UnpackContent; fix issue in gtime.NewFromTimeStamp

This commit is contained in:
John
2020-02-04 17:09:18 +08:00
parent 4c3af63076
commit 4d2b244319
8 changed files with 81 additions and 35 deletions

View File

@ -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"