changeset 8019:d685893d852e v7.4.1304

commit https://github.com/vim/vim/commit/7823a3bd2eed6ff9e544d201de96710bd5344aaf Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 11 21:08:32 2016 +0100 patch 7.4.1304 Problem: Function names are difficult to read. Solution: Rename jsonencode to json_encode, jsondecode to json_decode, jsencode to js_encode and jsdecode to js_decode.
author Christian Brabandt <cb@256bit.org>
date Thu, 11 Feb 2016 21:15:05 +0100
parents c47cff6ef75d
children 7250994a8654
files runtime/doc/eval.txt src/eval.c src/testdir/test_json.vim src/version.c
diffstat 4 files changed, 174 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1846,6 +1846,7 @@ delete( {fname} [, {flags}])	Number	dele
 did_filetype()			Number	TRUE if FileType autocommand event used
 diff_filler( {lnum})		Number	diff filler lines about {lnum}
 diff_hlID( {lnum}, {col})	Number	diff highlighting at {lnum}/{col}
+disable_char_avail_for_testing({expr})  none  test without typeahead
 empty( {expr})			Number	TRUE if {expr} is empty
 escape( {string}, {chars})	String	escape {chars} in {string} with '\'
 eval( {string})			any	evaluate {string} into its value
@@ -1952,14 +1953,14 @@ invert( {expr})			Number  bitwise invert
 isdirectory( {directory})	Number	TRUE if {directory} is a directory
 islocked( {expr})		Number	TRUE if {expr} is locked
 items( {dict})			List	key-value pairs in {dict}
-job_start({command} [, {options}]) Job	start a job	
-job_status({job})		String	get the status of a job
-job_stop({job} [, {how}])	Number	stop a job
+job_start( {command} [, {options}]) Job	start a job	
+job_status( {job})		String	get the status of a job
+job_stop( {job} [, {how}])	Number	stop a job
 join( {list} [, {sep}])		String	join {list} items into one String
-jsdecode( {string})		any	decode JS style JSON
-jsencode( {expr})		String	encode JS style JSON
-jsondecode( {string})		any	decode JSON
-jsonencode( {expr})		String	encode JSON
+js_decode( {string})		any	decode JS style JSON
+js_encode( {expr})		String	encode JS style JSON
+json_decode( {string})		any	decode JSON
+json_encode( {expr})		String	encode JSON
 keys( {dict})			List	keys in {dict}
 len( {expr})			Number	the length of {expr}
 libcall( {lib}, {func}, {arg})	String	call {func} in library {lib} with {arg}
@@ -2733,8 +2734,9 @@ copy({expr})	Make a copy of {expr}.	For 
 		When {expr} is a |List| a shallow copy is created.  This means
 		that the original |List| can be changed without changing the
 		copy, and vice versa.  But the items are identical, thus
-		changing an item changes the contents of both |Lists|.	Also
-		see |deepcopy()|.
+		changing an item changes the contents of both |Lists|.
+		A |Dictionary| is copied in a similar way as a |List|.
+		Also see |deepcopy()|.
 
 cos({expr})						*cos()*
 		Return the cosine of {expr}, measured in radians, as a |Float|.
@@ -4386,30 +4388,30 @@ join({list} [, {sep}])					*join()*
 		converted into a string like with |string()|.
 		The opposite function is |split()|.
 
-jsdecode({string})					*jsdecode()*
-		This is similar to |jsondecode()| with these differences:
+js_decode({string})					*js_decode()*
+		This is similar to |json_decode()| with these differences:
 		- Object key names do not have to be in quotes.
 		- Empty items in an array (between two commas) are allowed and
 		  result in v:none items.
 
-jsencode({expr})					*jsencode()*
-		This is similar to |jsonencode()| with these differences:
+js_encode({expr})					*js_encode()*
+		This is similar to |json_encode()| with these differences:
 		- Object key names are not in quotes.
 		- v:none items in an array result in an empty item between
 		  commas.
 		For example, the Vim object:
-			[1,v:none,{"one":1}],v:none ~
+			[1,v:none,{"one":1},v:none] ~
 		Will be encoded as:
 			[1,,{one:1},,] ~
-		While jsonencode() would produce:
+		While json_encode() would produce:
 			[1,null,{"one":1},null] ~
 		This encoding is valid for JavaScript. It is more efficient
 		than JSON, especially when using an array with optional items.
 
 
-jsondecode({string})					*jsondecode()*
+json_decode({string})					*json_decode()*
 		This parses a JSON formatted string and returns the equivalent
-		in Vim values.  See |jsonencode()| for the relation between
+		in Vim values.  See |json_encode()| for the relation between
 		JSON and Vim values.
 		The decoding is permissive:
 		- A trailing comma in an array and object is ignored.
@@ -4419,7 +4421,7 @@ jsondecode({string})					*jsondecode()*
 		- An empty object member name is not allowed.
 		- Duplicate object member names are not allowed.
 
-jsonencode({expr})					*jsonencode()*
+json_encode({expr})					*json_encode()*
 		Encode {expr} as JSON and return this as a string.
 		The encoding is specified in:
 		https://tools.ietf.org/html/rfc7159.html
--- a/src/eval.c
+++ b/src/eval.c
@@ -629,10 +629,10 @@ static void f_job_stop(typval_T *argvars
 static void f_job_status(typval_T *argvars, typval_T *rettv);
 #endif
 static void f_join(typval_T *argvars, typval_T *rettv);
-static void f_jsdecode(typval_T *argvars, typval_T *rettv);
-static void f_jsencode(typval_T *argvars, typval_T *rettv);
-static void f_jsondecode(typval_T *argvars, typval_T *rettv);
-static void f_jsonencode(typval_T *argvars, typval_T *rettv);
+static void f_js_decode(typval_T *argvars, typval_T *rettv);
+static void f_js_encode(typval_T *argvars, typval_T *rettv);
+static void f_json_decode(typval_T *argvars, typval_T *rettv);
+static void f_json_encode(typval_T *argvars, typval_T *rettv);
 static void f_keys(typval_T *argvars, typval_T *rettv);
 static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv);
 static void f_len(typval_T *argvars, typval_T *rettv);
@@ -8213,10 +8213,10 @@ static struct fst
     {"job_stop",	1, 2, f_job_stop},
 #endif
     {"join",		1, 2, f_join},
-    {"jsdecode",	1, 1, f_jsdecode},
-    {"jsencode",	1, 1, f_jsencode},
-    {"jsondecode",	1, 1, f_jsondecode},
-    {"jsonencode",	1, 1, f_jsonencode},
+    {"js_decode",	1, 1, f_js_decode},
+    {"js_encode",	1, 1, f_js_encode},
+    {"json_decode",	1, 1, f_json_decode},
+    {"json_encode",	1, 1, f_json_encode},
     {"keys",		1, 1, f_keys},
     {"last_buffer_nr",	0, 0, f_last_buffer_nr},/* obsolete */
     {"len",		1, 1, f_len},
@@ -14488,10 +14488,10 @@ f_join(typval_T *argvars, typval_T *rett
 }
 
 /*
- * "jsdecode()" function
- */
-    static void
-f_jsdecode(typval_T *argvars, typval_T *rettv)
+ * "js_decode()" function
+ */
+    static void
+f_js_decode(typval_T *argvars, typval_T *rettv)
 {
     js_read_T	reader;
 
@@ -14503,20 +14503,20 @@ f_jsdecode(typval_T *argvars, typval_T *
 }
 
 /*
- * "jsencode()" function
- */
-    static void
-f_jsencode(typval_T *argvars, typval_T *rettv)
+ * "js_encode()" function
+ */
+    static void
+f_js_encode(typval_T *argvars, typval_T *rettv)
 {
     rettv->v_type = VAR_STRING;
     rettv->vval.v_string = json_encode(&argvars[0], JSON_JS);
 }
 
 /*
- * "jsondecode()" function
- */
-    static void
-f_jsondecode(typval_T *argvars, typval_T *rettv)
+ * "json_decode()" function
+ */
+    static void
+f_json_decode(typval_T *argvars, typval_T *rettv)
 {
     js_read_T	reader;
 
@@ -14528,10 +14528,10 @@ f_jsondecode(typval_T *argvars, typval_T
 }
 
 /*
- * "jsonencode()" function
- */
-    static void
-f_jsonencode(typval_T *argvars, typval_T *rettv)
+ * "json_encode()" function
+ */
+    static void
+f_json_encode(typval_T *argvars, typval_T *rettv)
 {
     rettv->v_type = VAR_STRING;
     rettv->vval.v_string = json_encode(&argvars[0], 0);
--- a/src/testdir/test_json.vim
+++ b/src/testdir/test_json.vim
@@ -55,199 +55,199 @@ let s:jsonvals = '[true,false,null,null]
 let s:varvals = [v:true, v:false, v:null, v:null]
 
 func Test_json_encode()
-  call assert_equal(s:json1, jsonencode(s:var1))
-  call assert_equal(s:json2, jsonencode(s:var2))
-  call assert_equal(s:json3, jsonencode(s:var3))
-  call assert_equal(s:json4, jsonencode(s:var4))
-  call assert_equal(s:json5, jsonencode(s:var5))
+  call assert_equal(s:json1, json_encode(s:var1))
+  call assert_equal(s:json2, json_encode(s:var2))
+  call assert_equal(s:json3, json_encode(s:var3))
+  call assert_equal(s:json4, json_encode(s:var4))
+  call assert_equal(s:json5, json_encode(s:var5))
 
   if has('multi_byte')
-    call assert_equal(s:jsonmb, jsonencode(s:varmb))
+    call assert_equal(s:jsonmb, json_encode(s:varmb))
   endif
 
-  call assert_equal(s:jsonnr, jsonencode(s:varnr))
+  call assert_equal(s:jsonnr, json_encode(s:varnr))
   if has('float')
-    call assert_equal(s:jsonfl, jsonencode(s:varfl))
+    call assert_equal(s:jsonfl, json_encode(s:varfl))
   endif
 
-  call assert_equal(s:jsonl1, jsonencode(s:varl1))
-  call assert_equal(s:jsonl2, jsonencode(s:varl2))
-  call assert_equal(s:jsonl3, jsonencode(s:varl3))
+  call assert_equal(s:jsonl1, json_encode(s:varl1))
+  call assert_equal(s:jsonl2, json_encode(s:varl2))
+  call assert_equal(s:jsonl3, json_encode(s:varl3))
 
-  call assert_equal(s:jsond1, jsonencode(s:vard1))
-  call assert_equal(s:jsond2, jsonencode(s:vard2))
-  call assert_equal(s:jsond3, jsonencode(s:vard3))
-  call assert_equal(s:jsond4, jsonencode(s:vard4))
+  call assert_equal(s:jsond1, json_encode(s:vard1))
+  call assert_equal(s:jsond2, json_encode(s:vard2))
+  call assert_equal(s:jsond3, json_encode(s:vard3))
+  call assert_equal(s:jsond4, json_encode(s:vard4))
 
-  call assert_equal(s:jsonvals, jsonencode(s:varvals))
+  call assert_equal(s:jsonvals, json_encode(s:varvals))
 
-  call assert_fails('echo jsonencode(function("tr"))', 'E474:')
-  call assert_fails('echo jsonencode([function("tr")])', 'E474:')
+  call assert_fails('echo json_encode(function("tr"))', 'E474:')
+  call assert_fails('echo json_encode([function("tr")])', 'E474:')
 
-  silent! let res = jsonencode(function("tr"))
+  silent! let res = json_encode(function("tr"))
   call assert_equal("", res)
 endfunc
 
 func Test_json_decode()
-  call assert_equal(s:var1, jsondecode(s:json1))
-  call assert_equal(s:var2, jsondecode(s:json2))
-  call assert_equal(s:var3, jsondecode(s:json3))
-  call assert_equal(s:var4, jsondecode(s:json4))
-  call assert_equal(s:var5, jsondecode(s:json5))
+  call assert_equal(s:var1, json_decode(s:json1))
+  call assert_equal(s:var2, json_decode(s:json2))
+  call assert_equal(s:var3, json_decode(s:json3))
+  call assert_equal(s:var4, json_decode(s:json4))
+  call assert_equal(s:var5, json_decode(s:json5))
 
   if has('multi_byte')
-    call assert_equal(s:varmb, jsondecode(s:jsonmb))
+    call assert_equal(s:varmb, json_decode(s:jsonmb))
   endif
 
-  call assert_equal(s:varnr, jsondecode(s:jsonnr))
+  call assert_equal(s:varnr, json_decode(s:jsonnr))
   if has('float')
-    call assert_equal(s:varfl, jsondecode(s:jsonfl))
+    call assert_equal(s:varfl, json_decode(s:jsonfl))
   endif
 
-  call assert_equal(s:varl1, jsondecode(s:jsonl1))
-  call assert_equal(s:varl2x, jsondecode(s:jsonl2))
-  call assert_equal(s:varl2x, jsondecode(s:jsonl2s))
-  call assert_equal(s:varl3, jsondecode(s:jsonl3))
+  call assert_equal(s:varl1, json_decode(s:jsonl1))
+  call assert_equal(s:varl2x, json_decode(s:jsonl2))
+  call assert_equal(s:varl2x, json_decode(s:jsonl2s))
+  call assert_equal(s:varl3, json_decode(s:jsonl3))
 
-  call assert_equal(s:vard1, jsondecode(s:jsond1))
-  call assert_equal(s:vard2x, jsondecode(s:jsond2))
-  call assert_equal(s:vard2x, jsondecode(s:jsond2s))
-  call assert_equal(s:vard3, jsondecode(s:jsond3))
-  call assert_equal(s:vard4x, jsondecode(s:jsond4))
+  call assert_equal(s:vard1, json_decode(s:jsond1))
+  call assert_equal(s:vard2x, json_decode(s:jsond2))
+  call assert_equal(s:vard2x, json_decode(s:jsond2s))
+  call assert_equal(s:vard3, json_decode(s:jsond3))
+  call assert_equal(s:vard4x, json_decode(s:jsond4))
 
-  call assert_equal(s:varvals, jsondecode(s:jsonvals))
+  call assert_equal(s:varvals, json_decode(s:jsonvals))
 
-  call assert_equal(v:true, jsondecode('true'))
-  call assert_equal(type(v:true), type(jsondecode('true')))
-  call assert_equal(v:none, jsondecode(''))
-  call assert_equal(type(v:none), type(jsondecode('')))
-  call assert_equal("", jsondecode('""'))
+  call assert_equal(v:true, json_decode('true'))
+  call assert_equal(type(v:true), type(json_decode('true')))
+  call assert_equal(v:none, json_decode(''))
+  call assert_equal(type(v:none), type(json_decode('')))
+  call assert_equal("", json_decode('""'))
 
-  call assert_equal({'n': 1}, jsondecode('{"n":1,}'))
+  call assert_equal({'n': 1}, json_decode('{"n":1,}'))
 
-  call assert_fails('call jsondecode("\"")', "E474:")
-  call assert_fails('call jsondecode("blah")', "E474:")
-  call assert_fails('call jsondecode("true blah")', "E474:")
-  call assert_fails('call jsondecode("<foobar>")', "E474:")
+  call assert_fails('call json_decode("\"")', "E474:")
+  call assert_fails('call json_decode("blah")', "E474:")
+  call assert_fails('call json_decode("true blah")', "E474:")
+  call assert_fails('call json_decode("<foobar>")', "E474:")
 
-  call assert_fails('call jsondecode("{")', "E474:")
-  call assert_fails('call jsondecode("{foobar}")', "E474:")
-  call assert_fails('call jsondecode("{\"n\",")', "E474:")
-  call assert_fails('call jsondecode("{\"n\":")', "E474:")
-  call assert_fails('call jsondecode("{\"n\":1")', "E474:")
-  call assert_fails('call jsondecode("{\"n\":1,")', "E474:")
-  call assert_fails('call jsondecode("{\"n\",1}")', "E474:")
-  call assert_fails('call jsondecode("{-}")', "E474:")
+  call assert_fails('call json_decode("{")', "E474:")
+  call assert_fails('call json_decode("{foobar}")', "E474:")
+  call assert_fails('call json_decode("{\"n\",")', "E474:")
+  call assert_fails('call json_decode("{\"n\":")', "E474:")
+  call assert_fails('call json_decode("{\"n\":1")', "E474:")
+  call assert_fails('call json_decode("{\"n\":1,")', "E474:")
+  call assert_fails('call json_decode("{\"n\",1}")', "E474:")
+  call assert_fails('call json_decode("{-}")', "E474:")
 
-  call assert_fails('call jsondecode("[foobar]")', "E474:")
-  call assert_fails('call jsondecode("[")', "E474:")
-  call assert_fails('call jsondecode("[1")', "E474:")
-  call assert_fails('call jsondecode("[1,")', "E474:")
-  call assert_fails('call jsondecode("[1 2]")', "E474:")
+  call assert_fails('call json_decode("[foobar]")', "E474:")
+  call assert_fails('call json_decode("[")', "E474:")
+  call assert_fails('call json_decode("[1")', "E474:")
+  call assert_fails('call json_decode("[1,")', "E474:")
+  call assert_fails('call json_decode("[1 2]")', "E474:")
 
-  call assert_fails('call jsondecode("[1,,2]")', "E474:")
+  call assert_fails('call json_decode("[1,,2]")', "E474:")
 endfunc
 
 let s:jsl5 = '[7,,,]'
 let s:varl5 = [7, v:none, v:none]
 
 func Test_js_encode()
-  call assert_equal(s:json1, jsencode(s:var1))
-  call assert_equal(s:json2, jsencode(s:var2))
-  call assert_equal(s:json3, jsencode(s:var3))
-  call assert_equal(s:json4, jsencode(s:var4))
-  call assert_equal(s:json5, jsencode(s:var5))
+  call assert_equal(s:json1, js_encode(s:var1))
+  call assert_equal(s:json2, js_encode(s:var2))
+  call assert_equal(s:json3, js_encode(s:var3))
+  call assert_equal(s:json4, js_encode(s:var4))
+  call assert_equal(s:json5, js_encode(s:var5))
 
   if has('multi_byte')
-    call assert_equal(s:jsonmb, jsencode(s:varmb))
+    call assert_equal(s:jsonmb, js_encode(s:varmb))
   endif
 
-  call assert_equal(s:jsonnr, jsencode(s:varnr))
+  call assert_equal(s:jsonnr, js_encode(s:varnr))
   if has('float')
-    call assert_equal(s:jsonfl, jsencode(s:varfl))
+    call assert_equal(s:jsonfl, js_encode(s:varfl))
   endif
 
-  call assert_equal(s:jsonl1, jsencode(s:varl1))
-  call assert_equal(s:jsonl2, jsencode(s:varl2))
-  call assert_equal(s:jsonl3, jsencode(s:varl3))
+  call assert_equal(s:jsonl1, js_encode(s:varl1))
+  call assert_equal(s:jsonl2, js_encode(s:varl2))
+  call assert_equal(s:jsonl3, js_encode(s:varl3))
 
-  call assert_equal(s:jsd1, jsencode(s:vard1))
-  call assert_equal(s:jsd2, jsencode(s:vard2))
-  call assert_equal(s:jsd3, jsencode(s:vard3))
-  call assert_equal(s:jsd4, jsencode(s:vard4))
+  call assert_equal(s:jsd1, js_encode(s:vard1))
+  call assert_equal(s:jsd2, js_encode(s:vard2))
+  call assert_equal(s:jsd3, js_encode(s:vard3))
+  call assert_equal(s:jsd4, js_encode(s:vard4))
 
-  call assert_equal(s:jsonvals, jsencode(s:varvals))
+  call assert_equal(s:jsonvals, js_encode(s:varvals))
 
-  call assert_fails('echo jsencode(function("tr"))', 'E474:')
-  call assert_fails('echo jsencode([function("tr")])', 'E474:')
+  call assert_fails('echo js_encode(function("tr"))', 'E474:')
+  call assert_fails('echo js_encode([function("tr")])', 'E474:')
 
-  silent! let res = jsencode(function("tr"))
+  silent! let res = js_encode(function("tr"))
   call assert_equal("", res)
 
-  call assert_equal(s:jsl5, jsencode(s:varl5))
+  call assert_equal(s:jsl5, js_encode(s:varl5))
 endfunc
 
 func Test_js_decode()
-  call assert_equal(s:var1, jsdecode(s:json1))
-  call assert_equal(s:var2, jsdecode(s:json2))
-  call assert_equal(s:var3, jsdecode(s:json3))
-  call assert_equal(s:var4, jsdecode(s:json4))
-  call assert_equal(s:var5, jsdecode(s:json5))
+  call assert_equal(s:var1, js_decode(s:json1))
+  call assert_equal(s:var2, js_decode(s:json2))
+  call assert_equal(s:var3, js_decode(s:json3))
+  call assert_equal(s:var4, js_decode(s:json4))
+  call assert_equal(s:var5, js_decode(s:json5))
 
   if has('multi_byte')
-    call assert_equal(s:varmb, jsdecode(s:jsonmb))
+    call assert_equal(s:varmb, js_decode(s:jsonmb))
   endif
 
-  call assert_equal(s:varnr, jsdecode(s:jsonnr))
+  call assert_equal(s:varnr, js_decode(s:jsonnr))
   if has('float')
-    call assert_equal(s:varfl, jsdecode(s:jsonfl))
+    call assert_equal(s:varfl, js_decode(s:jsonfl))
   endif
 
-  call assert_equal(s:varl1, jsdecode(s:jsonl1))
-  call assert_equal(s:varl2x, jsdecode(s:jsonl2))
-  call assert_equal(s:varl2x, jsdecode(s:jsonl2s))
-  call assert_equal(s:varl3, jsdecode(s:jsonl3))
+  call assert_equal(s:varl1, js_decode(s:jsonl1))
+  call assert_equal(s:varl2x, js_decode(s:jsonl2))
+  call assert_equal(s:varl2x, js_decode(s:jsonl2s))
+  call assert_equal(s:varl3, js_decode(s:jsonl3))
 
-  call assert_equal(s:vard1, jsdecode(s:jsond1))
-  call assert_equal(s:vard1, jsdecode(s:jsd1))
-  call assert_equal(s:vard2x, jsdecode(s:jsond2))
-  call assert_equal(s:vard2x, jsdecode(s:jsd2))
-  call assert_equal(s:vard2x, jsdecode(s:jsond2s))
-  call assert_equal(s:vard2x, jsdecode(s:jsd2s))
-  call assert_equal(s:vard3, jsdecode(s:jsond3))
-  call assert_equal(s:vard3, jsdecode(s:jsd3))
-  call assert_equal(s:vard4x, jsdecode(s:jsond4))
-  call assert_equal(s:vard4x, jsdecode(s:jsd4))
+  call assert_equal(s:vard1, js_decode(s:jsond1))
+  call assert_equal(s:vard1, js_decode(s:jsd1))
+  call assert_equal(s:vard2x, js_decode(s:jsond2))
+  call assert_equal(s:vard2x, js_decode(s:jsd2))
+  call assert_equal(s:vard2x, js_decode(s:jsond2s))
+  call assert_equal(s:vard2x, js_decode(s:jsd2s))
+  call assert_equal(s:vard3, js_decode(s:jsond3))
+  call assert_equal(s:vard3, js_decode(s:jsd3))
+  call assert_equal(s:vard4x, js_decode(s:jsond4))
+  call assert_equal(s:vard4x, js_decode(s:jsd4))
 
-  call assert_equal(s:varvals, jsdecode(s:jsonvals))
+  call assert_equal(s:varvals, js_decode(s:jsonvals))
 
-  call assert_equal(v:true, jsdecode('true'))
-  call assert_equal(type(v:true), type(jsdecode('true')))
-  call assert_equal(v:none, jsdecode(''))
-  call assert_equal(type(v:none), type(jsdecode('')))
-  call assert_equal("", jsdecode('""'))
+  call assert_equal(v:true, js_decode('true'))
+  call assert_equal(type(v:true), type(js_decode('true')))
+  call assert_equal(v:none, js_decode(''))
+  call assert_equal(type(v:none), type(js_decode('')))
+  call assert_equal("", js_decode('""'))
 
-  call assert_equal({'n': 1}, jsdecode('{"n":1,}'))
+  call assert_equal({'n': 1}, js_decode('{"n":1,}'))
 
-  call assert_fails('call jsdecode("\"")', "E474:")
-  call assert_fails('call jsdecode("blah")', "E474:")
-  call assert_fails('call jsdecode("true blah")', "E474:")
-  call assert_fails('call jsdecode("<foobar>")', "E474:")
+  call assert_fails('call js_decode("\"")', "E474:")
+  call assert_fails('call js_decode("blah")', "E474:")
+  call assert_fails('call js_decode("true blah")', "E474:")
+  call assert_fails('call js_decode("<foobar>")', "E474:")
 
-  call assert_fails('call jsdecode("{")', "E474:")
-  call assert_fails('call jsdecode("{foobar}")', "E474:")
-  call assert_fails('call jsdecode("{\"n\",")', "E474:")
-  call assert_fails('call jsdecode("{\"n\":")', "E474:")
-  call assert_fails('call jsdecode("{\"n\":1")', "E474:")
-  call assert_fails('call jsdecode("{\"n\":1,")', "E474:")
-  call assert_fails('call jsdecode("{\"n\",1}")', "E474:")
-  call assert_fails('call jsdecode("{-}")', "E474:")
+  call assert_fails('call js_decode("{")', "E474:")
+  call assert_fails('call js_decode("{foobar}")', "E474:")
+  call assert_fails('call js_decode("{\"n\",")', "E474:")
+  call assert_fails('call js_decode("{\"n\":")', "E474:")
+  call assert_fails('call js_decode("{\"n\":1")', "E474:")
+  call assert_fails('call js_decode("{\"n\":1,")', "E474:")
+  call assert_fails('call js_decode("{\"n\",1}")', "E474:")
+  call assert_fails('call js_decode("{-}")', "E474:")
 
-  call assert_fails('call jsdecode("[foobar]")', "E474:")
-  call assert_fails('call jsdecode("[")', "E474:")
-  call assert_fails('call jsdecode("[1")', "E474:")
-  call assert_fails('call jsdecode("[1,")', "E474:")
-  call assert_fails('call jsdecode("[1 2]")', "E474:")
+  call assert_fails('call js_decode("[foobar]")', "E474:")
+  call assert_fails('call js_decode("[")', "E474:")
+  call assert_fails('call js_decode("[1")', "E474:")
+  call assert_fails('call js_decode("[1,")', "E474:")
+  call assert_fails('call js_decode("[1 2]")', "E474:")
 
-  call assert_equal(s:varl5, jsdecode(s:jsl5))
+  call assert_equal(s:varl5, js_decode(s:jsl5))
 endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -748,6 +748,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1304,
+/**/
     1303,
 /**/
     1302,