(t *testing.T)
| 1086 | } |
| 1087 | |
| 1088 | func TestTimeSub(t *testing.T) { |
| 1089 | // Subtracting two times returns a duration |
| 1090 | t1 := int64(1705318200000000000) // 2024-01-15 11:30:00 UTC |
| 1091 | t2 := int64(1705314600000000000) // 2024-01-15 10:30:00 UTC |
| 1092 | |
| 1093 | expr := ast.ApplyFn{symbols.TimeSub, []ast.BaseTerm{ |
| 1094 | ast.Time(t1), |
| 1095 | ast.Time(t2), |
| 1096 | }} |
| 1097 | got, err := EvalApplyFn(expr, ast.ConstSubstMap{}) |
| 1098 | if err != nil { |
| 1099 | t.Fatalf("EvalApplyFn(%v) failed with %v", expr, err) |
| 1100 | } |
| 1101 | want := ast.Duration(t1 - t2) |
| 1102 | if !got.Equals(want) { |
| 1103 | t.Errorf("EvalApplyFn(%v) = %v, want %v", expr, got, want) |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | func TestTimeFormat(t *testing.T) { |
| 1108 | // Format a time using RFC3339 |
nothing calls this directly
no test coverage detected