mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-22 16:07:49 +08:00
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package common
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/v2rayA/v2rayA/db/configure"
|
|
)
|
|
|
|
func TestUrlEncoded(t *testing.T) {
|
|
str := `试试1+就试试!`
|
|
t.Log(UrlEncoded(str))
|
|
}
|
|
|
|
func TestFillEmpty(t *testing.T) {
|
|
setting := &configure.Setting{
|
|
RulePortMode: "1",
|
|
ProxyModeWhenSubscribe: "2",
|
|
GFWListAutoUpdateMode: "3",
|
|
GFWListAutoUpdateIntervalHour: 4,
|
|
SubscriptionAutoUpdateMode: "5",
|
|
SubscriptionAutoUpdateIntervalHour: 6,
|
|
TcpFastOpen: "7",
|
|
MuxOn: "8",
|
|
Mux: 9,
|
|
Transparent: "10",
|
|
IpForward: false,
|
|
PortSharing: false,
|
|
TransparentType: "",
|
|
}
|
|
if err := FillEmpty(setting, configure.NewSetting()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
emptySetting := &configure.Setting{}
|
|
if err := FillEmpty(emptySetting, configure.NewSetting()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if *emptySetting != *configure.NewSetting() {
|
|
t.Fatal()
|
|
}
|
|
}
|