Skip to content
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

Update tests #17

Merged
merged 4 commits into from
Jan 23, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"
python-version: "3.10"

- name: Setup Vim
uses: rhysd/action-setup-vim@v1.2.8
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.nvim_version }}
Expand Down
14 changes: 7 additions & 7 deletions test/case/basic.vader
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ Execute (Check fibonacci sequence.):
AssertEqual [1, 2, 3, 5, 8, 13, 21], line_number_interval#fibonacci()

Execute (Check highlight with default color.):
AssertEqual "\nLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight LineNr')
AssertEqual "\nLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight LineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")

LineNumberIntervalEnable

AssertEqual "\nLineNr xxx ctermfg=0 guifg=Black", execute('highlight LineNr')
AssertEqual "\nDimLineNr xxx cleared", execute('highlight DimLineNr')
AssertEqual "\nHighlightedLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight HighlightedLineNr')
AssertEqual "\nHighlightedLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight HighlightedLineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")

LineNumberIntervalDisable

AssertEqual "\nLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight LineNr')
AssertEqual "\nLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight LineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")

Execute (Check highlight with configured color.):
highlight HighlightedLineNr guifg=White ctermfg=7
highlight DimLineNr guifg=Magenta ctermfg=5

AssertEqual "\nLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight LineNr')
AssertEqual "\nLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight LineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")

LineNumberIntervalEnable

Expand All @@ -34,7 +34,7 @@ Execute (Check highlight with configured color.):

LineNumberIntervalDisable

AssertEqual "\nLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight LineNr')
AssertEqual "\nLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight LineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")

Execute (Check autocmd.):
AssertThrows autocmd LineNumberInterval
Expand Down Expand Up @@ -65,12 +65,12 @@ Execute (Check sign group.):
AssertEqual "\n--- Signs ---\n", execute('sign place group=LineNumberGroup')

Execute (Check toggle.):
AssertEqual "\nLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight LineNr')
AssertEqual "\nLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight LineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")

LineNumberIntervalToggle

AssertEqual "\nLineNr xxx ctermfg=0 guifg=Black", execute('highlight LineNr')

LineNumberIntervalToggle

AssertEqual "\nLineNr xxx ctermfg=11 guifg=Yellow", execute('highlight LineNr')
AssertEqual "\nLineNr xxx guifg=NvimDarkGrey4", substitute(execute('highlight LineNr'), "ctermfg=11 guifg=Yellow", "guifg=NvimDarkGrey4", "")
8 changes: 4 additions & 4 deletions test/case/custom_interval.vader
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Execute (Check use_custom with default interval.):

AssertEqual [1, 2, 3, 5, 8, 13, 21], g:line_number_interval#custom_interval

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=3 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=4 id=3 group=LineNumberGroup name=LineNumberInterval priority=10\n line=6 id=4 group=LineNumberGroup name=LineNumberInterval priority=10\n line=9 id=5 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 id=6 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=3 group=LineNumberGroup name=LineNumberInterval priority=10\n line=4 group=LineNumberGroup name=LineNumberInterval priority=10\n line=6 group=LineNumberGroup name=LineNumberInterval priority=10\n line=9 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

14
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=1 id=6 group=LineNumberGroup name=LineNumberInterval priority=10\n line=6 id=5 group=LineNumberGroup name=LineNumberInterval priority=10\n line=9 id=4 group=LineNumberGroup name=LineNumberInterval priority=10\n line=11 id=3 group=LineNumberGroup name=LineNumberInterval priority=10\n line=12 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=13 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=15 id=7 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=6 group=LineNumberGroup name=LineNumberInterval priority=10\n line=9 group=LineNumberGroup name=LineNumberInterval priority=10\n line=11 group=LineNumberGroup name=LineNumberInterval priority=10\n line=12 group=LineNumberGroup name=LineNumberInterval priority=10\n line=13 group=LineNumberGroup name=LineNumberInterval priority=10\n line=15 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check use_custom with custom interval.):
let g:line_number_interval#use_custom = 1
Expand All @@ -44,9 +44,9 @@ Execute (Check use_custom with custom interval.):
2
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=5 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=11 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=5 group=LineNumberGroup name=LineNumberInterval priority=10\n line=11 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

11
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=8 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 id=3 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=8 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")
8 changes: 4 additions & 4 deletions test/case/multiple-colors.vader
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ Execute (Check multiple colors with relative number.):
2
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=5 id=1 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=11 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=5 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=11 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

11
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=8 id=1 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=14 id=3 group=LineNumberGroup name=LineNumberInterval1 priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 group=LineNumberGroup name=LineNumberInterval priority=10\n line=8 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=14 group=LineNumberGroup name=LineNumberInterval1 priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check multiple colors with set number.):
let g:line_number_interval#use_custom = 1
Expand All @@ -50,9 +50,9 @@ Execute (Check multiple colors with set number.):
2
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=5 id=2 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=5 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

11
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=8 id=2 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 id=3 group=LineNumberGroup name=LineNumberInterval1 priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=8 group=LineNumberGroup name=LineNumberInterval1 priority=10\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 group=LineNumberGroup name=LineNumberInterval1 priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")
12 changes: 6 additions & 6 deletions test/case/number.vader
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ Execute (Check set number.):
2
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

13
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

LineNumberIntervalDisable

AssertEqual "\n--- Signs ---\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "")

Execute (Check set number with fold.):
set number
Expand All @@ -46,7 +46,7 @@ Execute (Check set number with fold.):
4
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check set number on fold.):
set number
Expand All @@ -58,7 +58,7 @@ Execute (Check set number on fold.):
4
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check set number with configured interval.):
let g:line_number_interval = 7
Expand All @@ -70,4 +70,4 @@ Execute (Check set number with configured interval.):
3
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=7 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 id=2 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=7 group=LineNumberGroup name=LineNumberInterval priority=10\n line=14 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")
20 changes: 10 additions & 10 deletions test/case/relative_number.vader
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Execute (Check set relativenumber.):

LineNumberIntervalEnable

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=11 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=11 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

13
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=3 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=3 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check set relativenumber with fold.):
set relativenumber
Expand All @@ -39,12 +39,12 @@ Execute (Check set relativenumber with fold.):
1
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=14 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=14 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

15
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check set relativenumber on fold (forward).):
set relativenumber
Expand All @@ -58,12 +58,12 @@ Execute (Check set relativenumber on fold (forward).):
2
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=14 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=14 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

14
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check set relativenumber on fold (backward).):
set relativenumber
Expand All @@ -77,12 +77,12 @@ Execute (Check set relativenumber on fold (backward).):
12
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=2 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

2
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

Execute (Check set relativenumber with configured interval.):
let g:line_number_interval = 7
Expand All @@ -94,9 +94,9 @@ Execute (Check set relativenumber with configured interval.):
3
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=10 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")

13
doautocmd CursorMoved

AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=6 id=1 group=LineNumberGroup name=LineNumberInterval priority=10\n", execute('sign place group=LineNumberGroup')
AssertEqual "\n--- Signs ---\nSigns for [Vader-workbench]:\n line=6 group=LineNumberGroup name=LineNumberInterval priority=10\n", substitute(execute('sign place group=LineNumberGroup'), "id=\\d\\+", "", "g")