Skip to content

Commit 1efc169

Browse files
committed
✅ Add test for Go
1 parent 102e57c commit 1efc169

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/go/nursery.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { setup } = require('@ast-grep/nursery')
2+
const assert = require('node:assert')
23
const languageRegistration = require('./index')
34

45
setup({
@@ -7,6 +8,11 @@ setup({
78
treeSitterPackage: 'tree-sitter-go',
89
languageRegistration,
910
testRunner: parse => {
10-
// add test here
11+
const sg = parse(`func plus(a int, b int) int {
12+
return a + b
13+
}`)
14+
const root = sg.root()
15+
const node = root.find('func $A($$$) $B { $$$ }')
16+
assert.equal(node.kind(), 'function_declaration')
1117
},
1218
})

0 commit comments

Comments
 (0)