Skip to content

Commit

Permalink
fix: tree-sitter bindings examples, extend workflow to run examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Mar 25, 2024
1 parent bf89fe4 commit 35a7c7c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/tree_sitter_v.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

jobs:
test:
test-grammar:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -36,3 +36,32 @@ jobs:

- name: Verify formatting
run: npm run format:check

test-bindings:
runs-on: ubuntu-latest

steps:
- name: Install V
id: install-v
uses: vlang/[email protected]
with:
check-latest: true

- name: Checkout v-analyzer
uses: actions/checkout@v4
with:
submodules: true

- name: Run examples
run: |
cd tree_sitter_v
exit_code=0
for example in $(find -wholename '*/examples/*.v'); do
v run $example
if [ $? -ne 0 ]; then
exit_code=1
echo $exit_code
echo "Failed to run example \`$example\`"
fi
done
exit $exit_code
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module main

import tree_sitter_v.bindings
import bindings

fn main() {
mut p := bindings.new_parser[.NodeType](bindings.type_factory)
p.set_language(v.language)
mut p := bindings.new_parser[bindings.NodeType](bindings.type_factory)
p.set_language(bindings.language)

code := '
fn foo() int {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module main

import tree_sitter_v.bindings
import bindings

fn main() {
mut p := bindings.new_parser[bindings.NodeType](bindings.type_factory)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module main

import time
import tree_sitter_v.bindings
import bindings

fn main() {
mut p := bindings.new_parser[bindings.NodeType](bindings.type_factory)
Expand Down

0 comments on commit 35a7c7c

Please sign in to comment.