sq/libsq/ast/handle_test.go
Neil O'Toole db55986980
#307: Ingest cache (#354)
- Support for ingest cache, download cache, and progress bars.
2024-01-14 18:45:34 -07:00

33 lines
567 B
Go

package ast
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestExtractHandles(t *testing.T) {
testCases := []struct {
input string
want []string
}{
{
input: "@sakila | .actor",
want: []string{"@sakila"},
},
{
input: "@sakila_pg | .actor | join(@sakila_ms.film_actor, .actor_id)",
want: []string{"@sakila_ms", "@sakila_pg"},
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.input, func(t *testing.T) {
a := mustParse(t, tc.input)
got := ExtractHandles(a)
require.Equal(t, tc.want, got)
})
}
}