52 lines
851 B
Go
52 lines
851 B
Go
package GuideTaskCfg
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestGuideTaskCfg_NoPanic(t *testing.T) {
|
|
ids := []int{-1, 0, 1, 999999}
|
|
for _, id := range ids {
|
|
t.Run(fmt.Sprintf("Id=%d", id), func(t *testing.T) {
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
t.Fatalf("unexpected panic: %v", r)
|
|
}
|
|
}()
|
|
_ = GetTaskRewardById(id)
|
|
_ = GetTaskActive(id)
|
|
_, _ = GetActiveReward(id)
|
|
})
|
|
}
|
|
_ = GetUnlockLv()
|
|
_ = GetDays()
|
|
}
|
|
|
|
// 以下 Example 用于文档与编译校验(无固定输出校验)
|
|
|
|
func ExampleGetTaskRewardById() {
|
|
_ = GetTaskRewardById(1)
|
|
// Output:
|
|
}
|
|
|
|
func ExampleGetTaskActive() {
|
|
_ = GetTaskActive(1)
|
|
// Output:
|
|
}
|
|
|
|
func ExampleGetActiveReward() {
|
|
_, _ = GetActiveReward(1)
|
|
// Output:
|
|
}
|
|
|
|
func ExampleGetUnlockLv() {
|
|
_ = GetUnlockLv()
|
|
// Output:
|
|
}
|
|
|
|
func ExampleGetDays() {
|
|
_ = GetDays()
|
|
// Output:
|
|
}
|