@@ -376,18 +376,18 @@ function run_jsonlab_test(tests)
376376 fprintf(' Test JSONPath\n ' );
377377 fprintf(sprintf(' %s\n ' , char(ones(1 , 79 ) * 61 )));
378378
379- testdata = struct(' book' , struct(' title' , {' Minch' , ' Qui-Gon' , ' Ben' }, ' author' , {' Yoda' , ' Jinn' , ' Kenobi' }), ' game' , struct(' title' , ' Mario' ));
379+ testdata = struct(' book' , struct(' title' , {' Minch' , ' Qui-Gon' , ' Ben' }, ' author' , {' Yoda' , ' Jinn' , ' Kenobi' }), ' game' , struct(' title' , ' Mario' , ' new ' , struct( ' title ' , ' Minecraft ' ) ));
380380 test_jsonlab(' jsonpath of .key' , @savejson , jsonpath(testdata , ' $.game.title' ), ' "Mario"' , ' compact' , 1 );
381381 test_jsonlab(' jsonpath of ..key' , @savejson , jsonpath(testdata , ' $.book..title' ), ' ["Minch","Qui-Gon","Ben"]' , ' compact' , 1 );
382- test_jsonlab(' jsonpath of ..key cross objects' , @savejson , jsonpath(testdata , ' $..title' ), ' ["Minch","Qui-Gon","Ben","Mario"]' , ' compact' , 1 );
382+ test_jsonlab(' jsonpath of ..key cross objects' , @savejson , jsonpath(testdata , ' $..title' ), ' ["Minch","Qui-Gon","Ben","Mario","Minecraft" ]' , ' compact' , 1 );
383383 test_jsonlab(' jsonpath of [index]' , @savejson , jsonpath(testdata , ' $..title[1]' ), ' ["Qui-Gon"]' , ' compact' , 1 );
384- test_jsonlab(' jsonpath of [-index]' , @savejson , jsonpath(testdata , ' $..title[-1]' ), ' ["Mario "]' , ' compact' , 1 );
384+ test_jsonlab(' jsonpath of [-index]' , @savejson , jsonpath(testdata , ' $..title[-1]' ), ' ["Minecraft "]' , ' compact' , 1 );
385385 test_jsonlab(' jsonpath of [start:end]' , @savejson , jsonpath(testdata , ' $..title[0:2]' ), ' ["Minch","Qui-Gon","Ben"]' , ' compact' , 1 );
386386 test_jsonlab(' jsonpath of [:end]' , @savejson , jsonpath(testdata , ' $..title[:2]' ), ' ["Minch","Qui-Gon","Ben"]' , ' compact' , 1 );
387- test_jsonlab(' jsonpath of [start:]' , @savejson , jsonpath(testdata , ' $..title[1:]' ), ' ["Qui-Gon","Ben","Mario"]' , ' compact' , 1 );
388- test_jsonlab(' jsonpath of [-start:-end]' , @savejson , jsonpath(testdata , ' $..title[-2:-1]' ), ' ["Ben ","Mario "]' , ' compact' , 1 );
389- test_jsonlab(' jsonpath of [-start:]' , @savejson , jsonpath(testdata , ' $..title[:-3]' ), ' ["Minch","Qui-Gon"]' , ' compact' , 1 );
390- test_jsonlab(' jsonpath of [:-end]' , @savejson , jsonpath(testdata , ' $..title[-1:]' ), ' ["Mario "]' , ' compact' , 1 );
387+ test_jsonlab(' jsonpath of [start:]' , @savejson , jsonpath(testdata , ' $..title[1:]' ), ' ["Qui-Gon","Ben","Mario","Minecraft" ]' , ' compact' , 1 );
388+ test_jsonlab(' jsonpath of [-start:-end]' , @savejson , jsonpath(testdata , ' $..title[-2:-1]' ), ' ["Mario ","Minecraft "]' , ' compact' , 1 );
389+ test_jsonlab(' jsonpath of [-start:]' , @savejson , jsonpath(testdata , ' $..title[:-3]' ), ' ["Minch","Qui-Gon","Ben" ]' , ' compact' , 1 );
390+ test_jsonlab(' jsonpath of [:-end]' , @savejson , jsonpath(testdata , ' $..title[-1:]' ), ' ["Minecraft "]' , ' compact' , 1 );
391391 test_jsonlab(' jsonpath of object with [index]' , @savejson , jsonpath(testdata , ' $.book[1]' ), ' {"title":"Qui-Gon","author":"Jinn"}' , ' compact' , 1 );
392392 test_jsonlab(' jsonpath of element after [index]' , @savejson , jsonpath(testdata , ' $.book[1:2].author' ), ' ["Jinn","Kenobi"]' , ' compact' , 1 );
393393 test_jsonlab(' jsonpath of [*] and deep scan' , @savejson , jsonpath(testdata , ' $.book[*]..author' ), ' ["Yoda","Jinn","Kenobi"]' , ' compact' , 1 );
0 commit comments