We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3da76a4 commit 2368f72Copy full SHA for 2368f72
expr_test.go
@@ -1509,6 +1509,32 @@ func TestIssue270(t *testing.T) {
1509
}
1510
1511
1512
+func TestIssue271(t *testing.T) {
1513
+ type BarArray []float64
1514
+
1515
+ type Foo struct {
1516
+ Bar BarArray
1517
+ Baz int
1518
+ }
1519
1520
+ type Env struct {
1521
+ Foo Foo
1522
1523
1524
+ code := `Foo.Bar[0]`
1525
1526
+ program, err := expr.Compile(code, expr.Env(Env{}))
1527
+ require.NoError(t, err)
1528
1529
+ output, err := expr.Run(program, Env{
1530
+ Foo: Foo{
1531
+ Bar: BarArray{1.0, 2.0, 3.0},
1532
+ },
1533
+ })
1534
1535
+ require.Equal(t, 1.0, output)
1536
+}
1537
1538
// Mock types
1539
type mockEnv struct {
1540
Any interface{}
0 commit comments