diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-01-24 15:05:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-01-24 15:05:32 +0100 |
commit | 6039c7f05376f0e470cf62bf2757e653aea357f3 (patch) | |
tree | ab4cbced0c4d4ac6c48cdacd4d2472b8b615077f /src/testdir/test_json.vim | |
parent | 17a13437c9414a8693369a97f3be2fc8ad48c12e (diff) | |
download | vim-git-6039c7f05376f0e470cf62bf2757e653aea357f3.tar.gz |
patch 7.4.1164v7.4.1164
Problem: No tests for comparing special variables. Error in jsondecode()
not reported. test_json does not work Japanse system.
Solution: Set scriptencoding. (Ken Takata) Add a few more tests. Add error.
Diffstat (limited to 'src/testdir/test_json.vim')
-rw-r--r-- | src/testdir/test_json.vim | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/testdir/test_json.vim b/src/testdir/test_json.vim index b30647947..a1cfa93ac 100644 --- a/src/testdir/test_json.vim +++ b/src/testdir/test_json.vim @@ -1,4 +1,5 @@ " Test for JSON functions. +scriptencoding utf-8 let s:json1 = '"str\"in\\g"' let s:var1 = "str\"in\\g" @@ -95,11 +96,25 @@ func Test_decode() call assert_equal(type(v:none), type(jsondecode(''))) call assert_equal("", jsondecode('""')) + call assert_equal({'n': 1}, jsondecode('{"n":1,}')) + call assert_fails('call jsondecode("\"")', "E474:") - 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 jsondecode("[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 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:") endfunc |