(t *testing.T)
| 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 |
| 1071 | baseNanos := int64(1705314600000000000) |
| 1072 | hourNanos := int64(3600000000000) |
| 1073 | |
| 1074 | expr := ast.ApplyFn{symbols.TimeAdd, []ast.BaseTerm{ |
| 1075 | ast.Time(baseNanos), |
| 1076 | ast.Duration(hourNanos), |
| 1077 | }} |
| 1078 | got, err := EvalApplyFn(expr, ast.ConstSubstMap{}) |
| 1079 | if err != nil { |
| 1080 | t.Fatalf("EvalApplyFn(%v) failed with %v", expr, err) |
| 1081 | } |
| 1082 | want := ast.Time(baseNanos + hourNanos) |
| 1083 | if !got.Equals(want) { |
| 1084 | t.Errorf("EvalApplyFn(%v) = %v, want %v", expr, got, want) |
| 1085 | } |
| 1086 | } |
| 1087 | |
| 1088 | func TestTimeSub(t *testing.T) { |
| 1089 | // Subtracting two times returns a duration |
nothing calls this directly
no test coverage detected