1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
" vim-hackernews
" --------------
" Browse Hacker News (news.ycombinator.com) inside Vim.
"
" Author: ryanss <ryanssdev@icloud.com>
" Website: https://github.com/ryanss/vim-hackernews
" License: MIT (see LICENSE file)
" Version: 0.1.1
Execute (Test Plugin Loaded):
AssertEqual 1, filereadable('doc/hackernews.txt')
AssertEqual 1, filereadable('ftplugin/hackernews.py')
AssertEqual 1, filereadable('ftplugin/hackernews.vim')
AssertEqual 1, filereadable('plugin/hackernews.vim')
AssertEqual 1, filereadable('syntax/hackernews.vim')
redir @a
au BufRead *.hackernews
redir @b
au BufNewFile *.hackernews
redir @c
command HackerNews
redir END
Do (Test autocmd BufRead *.hackernews):
"apdd
Expect (set filetype=hackernews):
--- Auto-Commands ---
BufRead
*.hackernews
set filetype=hackernews
Do (Test autocmd BufNewFile *.hackernews):
"bpdd
Expect (set filetype=hackernews):
--- Auto-Commands ---
BufNewFile
*.hackernews
set filetype=hackernews
Do (Test HackerNews Defined):
"cpdddd
:%s/ \{2,}/ /g\<cr>
Expect (edit .hackernews):
HackerNews 0 edit .hackernews
Execute (Test HackerNews Command):
HackerNews
Then (Test Front Page):
AssertEqual getline(1), '┌───┐'
AssertEqual getline(2), '│ Y │ Hacker News (news.ycombinator.com)'
AssertEqual getline(3), '└───┘'
AssertEqual 'Comment', SyntaxAt(5,2), 'Item number syntax'
AssertEqual 'Comment', SyntaxAt(6,5), 'Point/user/comment line syntax'
AssertEqual '', SyntaxAt(5,5), 'Item title syntax'
|