update test

master
李光春 3 years ago
parent c0311aae8e
commit 4697deaffb

@ -0,0 +1,22 @@
name: Go
on:
push:
branches: [ v2 ]
pull_request:
branches: [ v2 ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Test
run: go test -v ./...

@ -5,6 +5,7 @@ import (
"strconv"
)
// Decimal 四舍五入
func Decimal(value float64) float64 {
value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
return value

@ -0,0 +1,10 @@
package decimal
import (
"log"
"testing"
)
func TestName(t *testing.T) {
log.Println(Decimal(2.3333))
}

@ -18,9 +18,9 @@ func TestName(t *testing.T) {
},
}
send, err := bot.Send(msg)
log.Printf("send%v\n", send)
if err != nil {
log.Printf("err%v\n", err)
t.Errorf("err%v\n", err)
return
}
log.Printf("send%v\n", send)
}

@ -1,11 +1,11 @@
package go_library
import (
"fmt"
"gopkg.in/dtapps/go-library.v2/library"
"log"
"testing"
)
func TestName(t *testing.T) {
fmt.Println(library.Version())
func TestVersion(t *testing.T) {
log.Println(library.Version())
}

@ -16,9 +16,9 @@ func TestName(t *testing.T) {
OrderId: 827669582783,
}
send, err := wl.Send(msg, url.Order)
log.Printf("send%s\n", send)
if err != nil {
log.Printf("错误%v\n", err)
t.Errorf("err%v\n", err)
return
}
log.Printf("返回:%s\n", send)
}

@ -17,9 +17,9 @@ func TestName(t *testing.T) {
},
}
send, err := bot.Send(msg)
log.Printf("send%v\n", send)
if err != nil {
log.Printf("err%v\n", err)
t.Errorf("err%v\n", err)
return
}
log.Printf("send%v\n", send)
}

@ -36,7 +36,7 @@ func GetCurrentWjDate() string {
return time.Now().Format("20060102")
}
func FormatISO8601Date(timestamp_second int64) string {
tm := time.Unix(timestamp_second, 0).UTC()
func FormatISO8601Date(timestampSecond int64) string {
tm := time.Unix(timestampSecond, 0).UTC()
return tm.Format(ISO8601Format)
}

@ -0,0 +1,14 @@
package time
import (
"log"
"testing"
)
func TestName(t *testing.T) {
log.Println(GetCurrentDate())
log.Println(GetCurrentUnix())
log.Println(GetCurrentMilliUnix())
log.Println(GetCurrentNanoUnix())
log.Println(GetCurrentWjDate())
}

@ -0,0 +1,21 @@
package url
import (
"log"
"testing"
)
func TestLenCode(t *testing.T) {
u := "https://www.dtapp.net"
log.Println(LenCode(u))
}
func TestDeCode(t *testing.T) {
u := "https%3A%2F%2Fwww.dtapp.net"
log.Println(DeCode(u))
}
func TestParseQuery(t *testing.T) {
u := "https://api.dtapp.net/v8/ip/qqwry?ip=113.118.170.199"
log.Println(ParseQuery(u))
}

@ -1,13 +1,11 @@
package uuid_test
import (
"fmt"
"gopkg.in/dtapps/go-library.v2/uuid"
"log"
"testing"
)
func TestName(t *testing.T) {
genUUID := uuid.GenUUID()
fmt.Println("Hello World")
fmt.Println(genUUID)
log.Println(uuid.GenUUID())
}

Loading…
Cancel
Save