| 1971 | } |
| 1972 | |
| 1973 | func TestIssue271(t *testing.T) { |
| 1974 | type BarArray []float64 |
| 1975 | |
| 1976 | type Foo struct { |
| 1977 | Bar BarArray |
| 1978 | Baz int |
| 1979 | } |
| 1980 | |
| 1981 | type Env struct { |
| 1982 | Foo Foo |
| 1983 | } |
| 1984 | |
| 1985 | code := `Foo.Bar[0]` |
| 1986 | |
| 1987 | program, err := expr.Compile(code, expr.Env(Env{})) |
| 1988 | require.NoError(t, err) |
| 1989 | |
| 1990 | output, err := expr.Run(program, Env{ |
| 1991 | Foo: Foo{ |
| 1992 | Bar: BarArray{1.0, 2.0, 3.0}, |
| 1993 | }, |
| 1994 | }) |
| 1995 | require.NoError(t, err) |
| 1996 | require.Equal(t, 1.0, output) |
| 1997 | } |
| 1998 | |
| 1999 | type Issue346Array []Issue346Type |
| 2000 | |