1
0
forked from aniani/vim

patch 7.4.2071

Problem:    The return value of type() is difficult to use.
Solution:   Define v:t_ constants. (Ken Takata)
This commit is contained in:
Bram Moolenaar
2016-07-19 17:25:25 +02:00
parent 6cfdb2a3ba
commit f562e72df7
7 changed files with 93 additions and 11 deletions

View File

@@ -950,6 +950,20 @@ func Test_type()
call assert_equal(6, type(v:true))
call assert_equal(7, type(v:none))
call assert_equal(7, type(v:null))
call assert_equal(8, v:t_job)
call assert_equal(9, v:t_channel)
call assert_equal(v:t_number, type(0))
call assert_equal(v:t_string, type(""))
call assert_equal(v:t_func, type(function("tr")))
call assert_equal(v:t_func, type(function("tr", [8])))
call assert_equal(v:t_list, type([]))
call assert_equal(v:t_dict, type({}))
call assert_equal(v:t_float, type(0.0))
call assert_equal(v:t_bool, type(v:false))
call assert_equal(v:t_bool, type(v:true))
call assert_equal(v:t_none, type(v:none))
call assert_equal(v:t_none, type(v:null))
call assert_equal(0, 0 + v:false)
call assert_equal(1, 0 + v:true)