File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20157,6 +20157,13 @@ f_type(argvars, rettv)
2015720157#ifdef FEAT_FLOAT
2015820158 case VAR_FLOAT: n = 5; break;
2015920159#endif
20160+ case VAR_SPECIAL:
20161+ if (argvars[0].vval.v_number == VVAL_FALSE
20162+ || argvars[0].vval.v_number == VVAL_TRUE)
20163+ n = 6;
20164+ else
20165+ n = 7;
20166+ break;
2016020167 default: EMSG2(_(e_intern2), "f_type()"); n = 0; break;
2016120168 }
2016220169 rettv->vval.v_number = n;
Original file line number Diff line number Diff line change @@ -88,4 +88,18 @@ func Test_decode()
8888 call assert_equal (s: vard2x , jsondecode (s: jsond2 ))
8989
9090 call assert_equal (s: varvals , jsondecode (s: jsonvals ))
91+
92+ call assert_equal (v: true , jsondecode (' true' ))
93+ call assert_equal (type (v: true ), type (jsondecode (' true' )))
94+ call assert_equal (v: none , jsondecode (' ' ))
95+ call assert_equal (type (v: none ), type (jsondecode (' ' )))
96+ call assert_equal (" " , jsondecode (' ""' ))
97+
98+ call assert_fails (' call jsondecode("\"")' , " E474:" )
99+ call assert_fails (' call jsondecode("{-}")' , " E474:" )
100+ call assert_fails (' call jsondecode("blah")' , " E474:" )
101+ call assert_fails (' call jsondecode("true blah")' , " E474:" )
102+ call assert_fails (' call jsondecode("<foobar>")' , " E474:" )
103+ call assert_fails (' call jsondecode("[foobar]")' , " E474:" )
104+ call assert_fails (' call jsondecode("{foobar}")' , " E474:" )
91105endfunc
Original file line number Diff line number Diff line change @@ -921,6 +921,23 @@ func Test_curlies()
921921 call assert_equal (77 , g: a [' t' ])
922922endfunc
923923
924+ " -------------------------------------------------------------------------------
925+ " Test 91: using type(). {{{1
926+ " -------------------------------------------------------------------------------
927+
928+ func Test_type ()
929+ call assert_equal (0 , type (0 ))
930+ call assert_equal (1 , type (" " ))
931+ call assert_equal (2 , type (function (" tr" )))
932+ call assert_equal (3 , type ([]))
933+ call assert_equal (4 , type ({}))
934+ call assert_equal (5 , type (0.0 ))
935+ call assert_equal (6 , type (v: false ))
936+ call assert_equal (6 , type (v: true ))
937+ call assert_equal (7 , type (v: none ))
938+ call assert_equal (7 , type (v: null ))
939+ endfunc
940+
924941" -------------------------------------------------------------------------------
925942" Modelines {{{1
926943" vim: ts = 8 sw = 4 tw = 80 fdm = marker
Original file line number Diff line number Diff line change @@ -741,6 +741,8 @@ static char *(features[]) =
741741
742742static int included_patches [] =
743743{ /* Add new patch number below this line */
744+ /**/
745+ 1157 ,
744746/**/
745747 1156 ,
746748/**/
You can’t perform that action at this time.
0 commit comments