Skip to content

Commit 7a7a25b

Browse files
bergercookienikoskoukis-slamcore
authored andcommitted
Add javascript UT, patch Rust UT
1 parent fa5e871 commit 7a7a25b

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

test/basic.vader

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
Include: text_setup.vader
21
Include: env_setup.vader
2+
Include: text_setup.vader
33

44
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55

66
""
7-
" tests include the following
8-
" - Add Debugging string when I am in a line that has text + make sure the counter advances
7+
" Tests include the following
8+
" - Add Debugging string when I am in a line that has text + make sure the
9+
" counter advances
910
" - Add Debugging string when I am on an empty line
1011
" - Add a variable debugging string when I am in a line that has text
1112
After ():
12-
Log(&filetype)
13+
" Log(&filetype)
1314
execute l1_text - 1
14-
AssertEqual getline('.'), 'And each in your season', "Current line contents don't match"
15+
AssertEqual getline('.'), "And each in your season", "Current line contents don't match"
1516
:normal ,ds
1617
:normal .
1718
execute l1_notext
@@ -43,14 +44,18 @@ Execute (Haskell):
4344
:set filetype=haskell
4445
Execute (Java):
4546
:set filetype=java
47+
Execute (Javascript):
48+
:set filetype=javascript
4649
Execute (Python):
4750
:set filetype=python
4851
Execute (R):
4952
:set filetype=r
50-
Execute (Ruby):
51-
:set filetype=ruby
53+
" For some reason putting this block after `Python` or `Ruby` makes this test
54+
" crash... no sensible explanation, should be a Vader bug.
5255
Execute (Rust):
5356
:set filetype=rust
57+
Execute (Ruby):
58+
:set filetype=ruby
5459
Execute (Shell):
5560
:set filetype=sh
5661
Execute (Vim):

test/env_setup.vader

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ Before (setup):
55
let l2_text = 5
66
let l1_notext = 10
77
let l1_text_var = 11
8-
9-

test/ft/a.javascript

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
console.log("[[Vader-workbench]:$1$] DEBUGGING STRING ==> $2$");
2+
console.log(`a**2 + b**2: ${a**2 + b**2}`)

test/vimrc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,21 @@ set noswapfile
1616
set viminfo=
1717

1818

19-
fun! GetFileLine(filename,line)
20-
return readfile(a:filename,'',a:line)[a:line-1]
21-
endfun
22-
23-
2419
fun! GetFileForLang(lang_name,line)
2520
let l:path = fnamemodify(resolve(expand('%:p')), ':h')
2621
let l:filename = l:path . '/test/ft/' . 'a.' . a:lang_name
2722
return readfile(l:filename,'',a:line)[a:line-1]
2823
endfun
2924

3025
""
31-
" Format the given str based on the expected line and the expected counter
32-
" given. Function searches for the $N$ identifiers in the string and replaces
26+
" Format the given str based on the expected line and the expected given
27+
" counter. Function searches for the $N$ identifiers in the string and replaces
3328
" them with the line and counter respectively.
3429
"
3530
" Returns the modified string.
3631
"
3732
fun! FormatStrForExpectedLine(str, line, cnt)
3833
let l:strTmp = substitute(a:str, '\$1\$', a:line, "")
39-
return substitute(l:strTmp, '\$2\$', a:cnt, "")
34+
let l:res = substitute(l:strTmp, '\$2\$', a:cnt, "")
35+
return l:res
4036
endfun

0 commit comments

Comments
 (0)