fix: handle encoded POC set values
测试构建 / 代码检查 (push) Canceled after 0s
测试构建 / 单元测试和构建 (push) Canceled after 0s
测试构建 / 构建验证 (push) Canceled after 0s

This commit is contained in:
ZacharyZcR
2026-09-01 15:09:00 +08:00
parent 75f4265098
commit b73c707a3b
5 changed files with 110 additions and 15 deletions
+17
View File
@@ -10,6 +10,7 @@ import (
"net/url"
"strings"
"testing"
"time"
"github.com/google/cel-go/common/types"
)
@@ -1393,3 +1394,19 @@ func TestMakeVarDecl(t *testing.T) {
})
}
}
func TestTimestampSecond(t *testing.T) {
before := time.Now().Unix()
result, err := Evaluate(GetBaseEnv(), "timestamp_second()", map[string]interface{}{})
if err != nil {
t.Fatal(err)
}
got, ok := result.Value().(int64)
if !ok {
t.Fatalf("timestamp_second() type = %T, want int64", result.Value())
}
after := time.Now().Unix()
if got < before || got > after {
t.Fatalf("timestamp_second() = %d, want [%d, %d]", got, before, after)
}
}