aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_expr.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_expr.vim')
-rw-r--r--src/nvim/testdir/test_expr.vim43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim
index b8d6f5aa7d..7b90ba56e0 100644
--- a/src/nvim/testdir/test_expr.vim
+++ b/src/nvim/testdir/test_expr.vim
@@ -125,22 +125,7 @@ func Test_option_value()
endfunc
function Test_printf_64bit()
- if has('num64')
- call assert_equal("123456789012345", printf('%d', 123456789012345))
- endif
-endfunc
-
-func Test_setmatches()
- hi def link 1 Comment
- hi def link 2 PreProc
- let set = [{"group": 1, "pattern": 2, "id": 3, "priority": 4}]
- let exp = [{"group": '1', "pattern": '2', "id": 3, "priority": 4}]
- if has('conceal')
- let set[0]['conceal'] = 5
- let exp[0]['conceal'] = '5'
- endif
- call setmatches(set)
- call assert_equal(exp, getmatches())
+ call assert_equal("123456789012345", printf('%d', 123456789012345))
endfunc
function Test_printf_spec_s()
@@ -168,6 +153,19 @@ function Test_printf_spec_s()
call assert_equal(string(function('printf', ['%s'])), printf('%s', function('printf', ['%s'])))
endfunc
+function Test_printf_spec_b()
+ call assert_equal("0", printf('%b', 0))
+ call assert_equal("00001100", printf('%08b', 12))
+ call assert_equal("11111111", printf('%08b', 0xff))
+ call assert_equal(" 1111011", printf('%10b', 123))
+ call assert_equal("0001111011", printf('%010b', 123))
+ call assert_equal(" 0b1111011", printf('%#10b', 123))
+ call assert_equal("0B01111011", printf('%#010B', 123))
+ call assert_equal("1001001100101100000001011010010", printf('%b', 1234567890))
+ call assert_equal("11100000100100010000110000011011101111101111001", printf('%b', 123456789012345))
+ call assert_equal("1111111111111111111111111111111111111111111111111111111111111111", printf('%b', -1))
+endfunc
+
function Test_printf_misc()
call assert_equal('123', printf('123'))
call assert_fails("call printf('123', 3)", "E767:")
@@ -482,6 +480,19 @@ func Test_funcref()
call assert_fails('let OneByRef = funcref("One", repeat(["foo"], 21))', 'E118:')
endfunc
+func Test_setmatches()
+ hi def link 1 Comment
+ hi def link 2 PreProc
+ let set = [{"group": 1, "pattern": 2, "id": 3, "priority": 4}]
+ let exp = [{"group": '1', "pattern": '2', "id": 3, "priority": 4}]
+ if has('conceal')
+ let set[0]['conceal'] = 5
+ let exp[0]['conceal'] = '5'
+ endif
+ call setmatches(set)
+ call assert_equal(exp, getmatches())
+endfunc
+
func Test_empty_concatenate()
call assert_equal('b', 'a'[4:0] . 'b')
call assert_equal('b', 'b' . 'a'[4:0])