|
@@ -36,11 +36,7 @@ endfunc
|
|
|
|
|
|
|
|
let s:errors = []
|
|
let s:errors = []
|
|
|
|
|
|
|
|
-func! MRU_assert_compare(match, expected, actual, ...)
|
|
|
|
|
- let msg = ''
|
|
|
|
|
- if a:0 == 1
|
|
|
|
|
- let msg = a:1
|
|
|
|
|
- endif
|
|
|
|
|
|
|
+func! MRU_assert_compare(match, expected, actual, msg)
|
|
|
if a:match
|
|
if a:match
|
|
|
let passed = a:actual =~# a:expected
|
|
let passed = a:actual =~# a:expected
|
|
|
else
|
|
else
|
|
@@ -62,6 +58,22 @@ func! MRU_assert_compare(match, expected, actual, ...)
|
|
|
endif
|
|
endif
|
|
|
endfunc
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
+func! MRU_assert_equal(expected, actual, ...)
|
|
|
|
|
+ let msg = ''
|
|
|
|
|
+ if a:0 == 1
|
|
|
|
|
+ let msg = a:1
|
|
|
|
|
+ endif
|
|
|
|
|
+ call MRU_assert_compare(0, a:expected, a:actual, msg)
|
|
|
|
|
+endfunc
|
|
|
|
|
+
|
|
|
|
|
+func! MRU_assert_match(expected, actual, ...)
|
|
|
|
|
+ let msg = ''
|
|
|
|
|
+ if a:0 == 1
|
|
|
|
|
+ let msg = a:1
|
|
|
|
|
+ endif
|
|
|
|
|
+ call MRU_assert_compare(1, a:expected, a:actual, msg)
|
|
|
|
|
+endfunc
|
|
|
|
|
+
|
|
|
func! MRU_assert_true(result, ...)
|
|
func! MRU_assert_true(result, ...)
|
|
|
let msg = ''
|
|
let msg = ''
|
|
|
if a:0 == 1
|
|
if a:0 == 1
|
|
@@ -84,8 +96,8 @@ if s:builtin_assert
|
|
|
let s:Assert_true = function('assert_true')
|
|
let s:Assert_true = function('assert_true')
|
|
|
else
|
|
else
|
|
|
" Vim doesn't have support for the assert_xxx() functions
|
|
" Vim doesn't have support for the assert_xxx() functions
|
|
|
- let s:Assert_equal = function('MRU_assert_compare', [0])
|
|
|
|
|
- let s:Assert_match = function('MRU_assert_compare', [1])
|
|
|
|
|
|
|
+ let s:Assert_equal = function('MRU_assert_equal')
|
|
|
|
|
+ let s:Assert_match = function('MRU_assert_match')
|
|
|
let s:Assert_true = function('MRU_assert_true')
|
|
let s:Assert_true = function('MRU_assert_true')
|
|
|
endif
|
|
endif
|
|
|
|
|
|