Skip to content

Add syntax test #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Install packages
run: |
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt update
sudo apt install neovim
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
Expand All @@ -22,3 +20,5 @@ jobs:
nvim --version
vim --version
make test
- name: Test syntax
run: make test-syntax
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Clone the repo
- `npm install` dependencies
- `make test` to run the tests
- `make test-syntax`, require Neovim >= 0.9.0

**Working within VIM**

Expand All @@ -21,6 +22,20 @@ Plug ~/Projects/vim-rescript
**Integration Specs:**
For all the informal specs about editor integration & the ReScript platform, check out the [CONTRIBUTING](https://github.com/rescript-lang/rescript-vscode/blob/master/CONTRIBUTING.md) file of the rescript-vscode reference implementation.

### Syntax Tests

Syntax tests require Neovim >= 0.9.0

#### Adding new tests

- Create or edit a file at `test/syntax/` directory.
- Write some code and add a comment in the following format: `//^` below the code. The `^` indicates the capture location. Example:
```rescript
let a = true
//^
```
- Run `make test-syntax`

### Use custom rescript-editor-support.exe

> Note: Don't do this as a ReScript user. This is only intended for extension development purposes only.
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ export INMAKE

test:
@$(MYVIM) -u ./test/test_all.vim

test-syntax:
nvim -l test/test-syntax.lua
git diff --name-only --exit-code -- 'test/syntax/expected/*.res.txt'
271 changes: 271 additions & 0 deletions test/syntax/expected/highlight.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
{ {
col = 1,
row = 0,
syntax = { {
hl_group = "resArrowPipe",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 3,
syntax = {}
}, {
col = 1,
row = 6,
syntax = { {
hl_group = "resAttribute",
hl_group_link = "PreProc"
} }
}, {
col = 9,
row = 8,
syntax = {}
}, {
col = 1,
row = 11,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 7,
row = 14,
syntax = {}
}, {
col = 9,
row = 17,
syntax = { {
hl_group = "resBoolean",
hl_group_link = "Constant"
} }
}, {
col = 9,
row = 19,
syntax = { {
hl_group = "resBoolean",
hl_group_link = "Constant"
} }
}, {
col = 11,
row = 22,
syntax = { {
hl_group = "resString",
hl_group_link = "Constant"
} }
}, {
col = 19,
row = 24,
syntax = { {
hl_group = "resString",
hl_group_link = "Constant"
} }
}, {
col = 8,
row = 26,
syntax = { {
hl_group = "resChar",
hl_group_link = "Constant"
} }
}, {
col = 11,
row = 29,
syntax = { {
hl_group = "resString",
hl_group_link = "Constant"
} }
}, {
col = 8,
row = 32,
syntax = {}
}, {
col = 12,
row = 34,
syntax = {}
}, {
col = 12,
row = 37,
syntax = {}
}, {
col = 7,
row = 40,
syntax = {}
}, {
col = 9,
row = 43,
syntax = {}
}, {
col = 9,
row = 46,
syntax = {}
}, {
col = 1,
row = 49,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 4,
row = 52,
syntax = {}
}, {
col = 7,
row = 56,
syntax = { {
hl_group = "resType",
hl_group_link = "Type"
} }
}, {
col = 7,
row = 61,
syntax = {}
}, {
col = 9,
row = 65,
syntax = { {
hl_group = "resType",
hl_group_link = "Type"
} }
}, {
col = 11,
row = 68,
syntax = {}
}, {
col = 9,
row = 71,
syntax = { {
hl_group = "resModuleOrVariant",
hl_group_link = "Identifier"
} }
}, {
col = 9,
row = 74,
syntax = { {
hl_group = "resPolyVariant",
hl_group_link = "Identifier"
} }
}, {
col = 7,
row = 77,
syntax = {}
}, {
col = 3,
row = 80,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 85,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 2,
row = 87,
syntax = { {
hl_group = "resModuleChain",
hl_group_link = "PreProc"
} }
}, {
col = 1,
row = 91,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 96,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 100,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 3,
row = 103,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 17,
row = 105,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 109,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 112,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 116,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 1,
row = 118,
syntax = {}
}, {
col = 5,
row = 120,
syntax = {}
}, {
col = 5,
row = 124,
syntax = { {
hl_group = "resType",
hl_group_link = "Type"
} }
}, {
col = 5,
row = 126,
syntax = { {
hl_group = "resType",
hl_group_link = "Type"
} }
}, {
col = 5,
row = 128,
syntax = { {
hl_group = "resKeyword",
hl_group_link = "Statement"
} }
}, {
col = 4,
row = 130,
syntax = { {
hl_group = "resType",
hl_group_link = "Type"
} }
}, {
col = 5,
row = 132,
syntax = { {
hl_group = "resType",
hl_group_link = "Type"
} }
} }
Loading