Skip to content

Commit 6926641

Browse files
authored
Merge pull request #496 from mcarmonaa/fix/uast-extract-returned-type
internal/function: fix uast_extract returned type
2 parents c0bfc58 + 0d797cb commit 6926641

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ before_script:
2323
- docker run -d --name bblfshd --privileged -p 9432:9432 -v /var/lib/bblfshd:/var/lib/bblfshd bblfsh/bblfshd
2424
- docker exec -it bblfshd bblfshctl driver install python bblfsh/python-driver
2525
- docker exec -it bblfshd bblfshctl driver install php bblfsh/php-driver
26+
- docker exec -it bblfshd bblfshctl driver install go bblfsh/go-driver
2627

2728
script:
2829
- make test-coverage codecov

integration_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,18 @@ func TestIntegration(t *testing.T) {
230230
{"e8d3ffab552895c19b9fcf7aa264d277cde33881", "some code in a branch\n", "php", "dbd3641b371024f44d0e469a9c8f5457b0660de1"},
231231
},
232232
},
233+
{
234+
`SELECT
235+
file_path, array_length(uast_extract(uast(blob_content, language(file_path)), "@type"))
236+
FROM
237+
files
238+
WHERE
239+
language(file_path)="Go"
240+
LIMIT 1`,
241+
[]sql.Row{
242+
{"go/example.go", int32(1)},
243+
},
244+
},
233245
}
234246

235247
runTests := func(t *testing.T) {

internal/function/uast.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ func (u *UASTExtract) Eval(ctx *sql.Context, row sql.Row) (out interface{}, err
458458
return nil, nil
459459
}
460460

461-
extracted := make([][]string, len(nodes))
461+
extracted := make([]interface{}, len(nodes))
462462
for i, n := range nodes {
463463
extracted[i] = extractInfo(n, key)
464464
}

0 commit comments

Comments
 (0)