(t *testing.T)
| 1051 | } |
| 1052 | |
| 1053 | func TestTimeNow(t *testing.T) { |
| 1054 | expr := ast.ApplyFn{symbols.TimeNow, nil} |
| 1055 | got, err := EvalApplyFn(expr, ast.ConstSubstMap{}) |
| 1056 | if err != nil { |
| 1057 | t.Fatalf("EvalApplyFn(%v) failed with %v", expr, err) |
| 1058 | } |
| 1059 | if got.Type != ast.TimeType { |
| 1060 | t.Errorf("EvalApplyFn(%v) returned type %v, want TimeType", expr, got.Type) |
| 1061 | } |
| 1062 | // Check that the time is reasonable (within last minute) |
| 1063 | nanos, _ := got.TimeValue() |
| 1064 | if nanos <= 0 { |
| 1065 | t.Errorf("fn:time:now returned non-positive time: %d", nanos) |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | func TestTimeAdd(t *testing.T) { |
| 1070 | // 2024-01-15 10:30:00 UTC + 1 hour = 2024-01-15 11:30:00 UTC |
nothing calls this directly
no test coverage detected