11cb0ef41Sopenharmony_civar test = require('tape'); 21cb0ef41Sopenharmony_civar Parser = require('../'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_civar expected = [ 51cb0ef41Sopenharmony_ci [ [], '' ], 61cb0ef41Sopenharmony_ci [ [], 'Hello' ], 71cb0ef41Sopenharmony_ci [ [], 'This"is' ], 81cb0ef41Sopenharmony_ci [ [], '\r\n\f\t\\/"' ], 91cb0ef41Sopenharmony_ci [ [], 'Λάμβδα' ], 101cb0ef41Sopenharmony_ci [ [], '\\' ], 111cb0ef41Sopenharmony_ci [ [], '/' ], 121cb0ef41Sopenharmony_ci [ [], '"' ], 131cb0ef41Sopenharmony_ci [ [ 0 ], 0 ], 141cb0ef41Sopenharmony_ci [ [ 1 ], 1 ], 151cb0ef41Sopenharmony_ci [ [ 2 ], -1 ], 161cb0ef41Sopenharmony_ci [ [], [ 0, 1, -1 ] ], 171cb0ef41Sopenharmony_ci [ [ 0 ], 1 ], 181cb0ef41Sopenharmony_ci [ [ 1 ], 1.1 ], 191cb0ef41Sopenharmony_ci [ [ 2 ], -1.1 ], 201cb0ef41Sopenharmony_ci [ [ 3 ], -1 ], 211cb0ef41Sopenharmony_ci [ [], [ 1, 1.1, -1.1, -1 ] ], 221cb0ef41Sopenharmony_ci [ [ 0 ], -1 ], 231cb0ef41Sopenharmony_ci [ [], [ -1 ] ], 241cb0ef41Sopenharmony_ci [ [ 0 ], -0.1 ], 251cb0ef41Sopenharmony_ci [ [], [ -0.1 ] ], 261cb0ef41Sopenharmony_ci [ [ 0 ], 6.02e+23 ], 271cb0ef41Sopenharmony_ci [ [], [ 6.02e+23 ] ], 281cb0ef41Sopenharmony_ci [ [ 0 ], '7161093205057351174' ], 291cb0ef41Sopenharmony_ci [ [], [ '7161093205057351174'] ] 301cb0ef41Sopenharmony_ci]; 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_citest('primitives', function (t) { 331cb0ef41Sopenharmony_ci t.plan(25); 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci var p = new Parser(); 361cb0ef41Sopenharmony_ci p.onValue = function (value) { 371cb0ef41Sopenharmony_ci var keys = this.stack 381cb0ef41Sopenharmony_ci .slice(1) 391cb0ef41Sopenharmony_ci .map(function (item) { return item.key }) 401cb0ef41Sopenharmony_ci .concat(this.key !== undefined ? this.key : []) 411cb0ef41Sopenharmony_ci ; 421cb0ef41Sopenharmony_ci t.deepEqual( 431cb0ef41Sopenharmony_ci [ keys, value ], 441cb0ef41Sopenharmony_ci expected.shift() 451cb0ef41Sopenharmony_ci ); 461cb0ef41Sopenharmony_ci }; 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci p.write('"""Hello""This\\"is""\\r\\n\\f\\t\\\\\\/\\""'); 491cb0ef41Sopenharmony_ci p.write('"\\u039b\\u03ac\\u03bc\\u03b2\\u03b4\\u03b1"'); 501cb0ef41Sopenharmony_ci p.write('"\\\\"'); 511cb0ef41Sopenharmony_ci p.write('"\\/"'); 521cb0ef41Sopenharmony_ci p.write('"\\""'); 531cb0ef41Sopenharmony_ci p.write('[0,1,-1]'); 541cb0ef41Sopenharmony_ci p.write('[1.0,1.1,-1.1,-1.0][-1][-0.1]'); 551cb0ef41Sopenharmony_ci p.write('[6.02e23]'); 561cb0ef41Sopenharmony_ci p.write('[7161093205057351174]'); 571cb0ef41Sopenharmony_ci}); 58