Skip to content

Commit 293e310

Browse files
committed
feat: add tests
1 parent 7bc502e commit 293e310

File tree

5 files changed

+110
-0
lines changed

5 files changed

+110
-0
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
4+
jobs:
5+
tests:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: Install Vim
10+
run: sudo apt-get install vim
11+
- name: Install Vader
12+
run: |
13+
git clone https://github.com/junegunn/vader.vim.git
14+
echo "set rtp+=vader.vim" > ~/.vimrc
15+
- name: Run tests
16+
run: ./run-tests.sh

run-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
vim -Es -c 'Vader! tests/*.vader' > /dev/null

tests/features.vader

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Execute (Diff Mode):
2+
" Test diff mode colors
3+
let diff_add = synIDattr(hlID('DiffAdd'), 'bg#')
4+
Assert diff_add ==# '#4EBE96', 'Added lines should have correct background'
5+
6+
let diff_delete = synIDattr(hlID('DiffDelete'), 'bg#')
7+
Assert diff_delete ==# '#FF5C5C', 'Deleted lines should have correct background'
8+
9+
Execute (Search Highlighting):
10+
let search_bg = synIDattr(hlID('Search'), 'bg#')
11+
Assert search_bg ==# '#5C6974', 'Search highlight should have correct background'

tests/oscura-dusk.vader

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
" Test file for Oscura Dusk colorscheme
2+
" Install Vader: https://github.com/junegunn/vader.vim
3+
4+
Before (Setup):
5+
colorscheme oscura-dusk
6+
syntax enable
7+
8+
Execute (Basic Color Definitions):
9+
let colors = {
10+
\ 'bg': '#131419',
11+
\ 'fg': '#E6E6E6',
12+
\ 'comment': '#46474F',
13+
\ 'keyword': '#9099A1',
14+
\ 'function': '#E6E7A3',
15+
\ 'string': '#F9B98C'
16+
\ }
17+
18+
" Test background color
19+
let bg_color = synIDattr(hlID('Normal'), 'bg#')
20+
Assert bg_color ==# colors.bg, 'Background color should be '.colors.bg.' but got '.bg_color
21+
22+
" Test foreground color
23+
let fg_color = synIDattr(hlID('Normal'), 'fg#')
24+
Assert fg_color ==# colors.fg, 'Foreground color should be '.colors.fg.' but got '.fg_color
25+
26+
Execute (Syntax Highlighting):
27+
" Test comment highlighting
28+
let comment_color = synIDattr(hlID('Comment'), 'fg#')
29+
Assert comment_color ==# colors.comment, 'Comment color should be '.colors.comment
30+
31+
" Test function highlighting
32+
let func_color = synIDattr(hlID('Function'), 'fg#')
33+
Assert func_color ==# colors.function, 'Function color should be '.colors.function
34+
35+
Execute (TypeScript Support):
36+
" Test TypeScript specific highlights
37+
let ts_keyword = synIDattr(hlID('typescriptKeyword'), 'fg#')
38+
Assert ts_keyword ==# colors.keyword, 'TypeScript keyword color should be '.colors.keyword
39+
40+
let ts_func = synIDattr(hlID('typescriptFuncName'), 'fg#')
41+
Assert ts_func ==# colors.function, 'TypeScript function name color should be '.colors.function
42+
43+
Execute (UI Elements):
44+
" Test UI elements like status line, line numbers, etc.
45+
let line_nr = synIDattr(hlID('LineNr'), 'fg#')
46+
Assert line_nr ==# '#32333B', 'Line number color should be #32333B'
47+
48+
let cursor_line_bg = synIDattr(hlID('CursorLine'), 'bg#')
49+
Assert cursor_line_bg ==# '#232323', 'Cursor line background should be #232323'
50+
51+
Execute (Special Highlights):
52+
" Test special syntax elements
53+
let string_color = synIDattr(hlID('String'), 'fg#')
54+
Assert string_color ==# colors.string, 'String color should be '.colors.string
55+
56+
" Test if italic style is applied to comments
57+
let comment_style = synIDattr(hlID('Comment'), 'italic')
58+
Assert comment_style == 1, 'Comments should be italic'
59+
60+
Execute (Terminal Colors):
61+
if has('nvim')
62+
" Test terminal colors in Neovim
63+
Assert g:terminal_color_0 ==# colors.bg, 'Terminal color 0 should match background'
64+
Assert g:terminal_color_7 ==# colors.fg, 'Terminal color 7 should match foreground'
65+
endif

tests/typescript.vader

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
" TypeScript specific tests
2+
Before (Setup TypeScript):
3+
set filetype=typescript
4+
colorscheme oscura-dusk
5+
6+
Execute (TypeScript Syntax):
7+
" Create a temporary TypeScript buffer
8+
put =['interface Test {', ' prop: string;', '}']
9+
10+
" Test interface highlighting
11+
let interface_color = synIDattr(synID(1, 1, 1), 'fg#')
12+
Assert interface_color ==# '#E6E7A3', 'Interface keyword should be light yellow'
13+
14+
" Test type annotation highlighting
15+
let type_color = synIDattr(synID(2, 8, 1), 'fg#')
16+
Assert type_color ==# '#E6E7A3', 'Type annotation should be light yellow'

0 commit comments

Comments
 (0)