mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 11:18:02 +08:00
26 lines
653 B
Go
26 lines
653 B
Go
// Copyright 2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package gconv_test
|
|
|
|
import (
|
|
"github.com/gogf/gf/test/gtest"
|
|
"github.com/gogf/gf/util/gconv"
|
|
"testing"
|
|
)
|
|
|
|
func Test_Unsafe(t *testing.T) {
|
|
gtest.C(t, func(t *gtest.T) {
|
|
s := "I love 小泽玛利亚"
|
|
t.AssertEQ(gconv.UnsafeStrToBytes(s), []byte(s))
|
|
})
|
|
|
|
gtest.C(t, func(t *gtest.T) {
|
|
b := []byte("I love 小泽玛利亚")
|
|
t.AssertEQ(gconv.UnsafeBytesToStr(b), string(b))
|
|
})
|
|
}
|