| 409 | } |
| 410 | |
| 411 | func TestCompile_panic(t *testing.T) { |
| 412 | tests := []string{ |
| 413 | `(TotalPosts.Profile[Authors > TotalPosts == get(nil, TotalLikes)] > Authors) ^ (TotalLikes / (Posts?.PublishDate[TotalPosts] < Posts))`, |
| 414 | `one(Posts, nil)`, |
| 415 | `trim(TotalViews, Posts) <= get(Authors, nil)`, |
| 416 | `Authors.IsZero(nil * Authors) - (TotalViews && Posts ? nil : nil)[TotalViews.IsZero(false, " ").IsZero(Authors)]`, |
| 417 | } |
| 418 | for _, test := range tests { |
| 419 | t.Run(test, func(t *testing.T) { |
| 420 | _, err := expr.Compile(test, expr.Env(playground.Blog{})) |
| 421 | require.Error(t, err) |
| 422 | }) |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | func TestCompile_FuncTypes(t *testing.T) { |
| 427 | env := map[string]any{ |