patch 7.4.2071
Problem: The return value of type() is difficult to use.
Solution: Define v:t_ constants. (Ken Takata)
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index ea7abd4..af9060a 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -188,6 +188,7 @@
" Test that we can open two channels.
func Ch_two_channels(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
+ call assert_equal(v:t_channel, type(handle))
if ch_status(handle) == "fail"
call assert_false(1, "Can't open channel")
return
@@ -420,6 +421,7 @@
endif
call ch_log('Test_raw_pipe()')
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
+ call assert_equal(v:t_job, type(job))
call assert_equal("run", job_status(job))
try
" For a change use the job where a channel is expected.
diff --git a/src/testdir/test_viml.vim b/src/testdir/test_viml.vim
index 85baf12..3a195dd 100644
--- a/src/testdir/test_viml.vim
+++ b/src/testdir/test_viml.vim
@@ -950,6 +950,20 @@
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)