11cb0ef41Sopenharmony_civar test = require('tape'); 21cb0ef41Sopenharmony_civar Parser = require('../'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_citest('3 bytes of utf8', function (t) { 51cb0ef41Sopenharmony_ci t.plan(1); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci var p = new Parser(); 81cb0ef41Sopenharmony_ci p.onValue = function (value) { 91cb0ef41Sopenharmony_ci t.equal(value, '├──'); 101cb0ef41Sopenharmony_ci }; 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci p.write('"├──"'); 131cb0ef41Sopenharmony_ci}); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_citest('utf8 snowman', function (t) { 161cb0ef41Sopenharmony_ci t.plan(1); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci var p = new Parser(); 191cb0ef41Sopenharmony_ci p.onValue = function (value) { 201cb0ef41Sopenharmony_ci t.equal(value, '☃'); 211cb0ef41Sopenharmony_ci }; 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci p.write('"☃"'); 241cb0ef41Sopenharmony_ci}); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_citest('utf8 with regular ascii', function (t) { 271cb0ef41Sopenharmony_ci t.plan(4); 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ci var p = new Parser(); 301cb0ef41Sopenharmony_ci var expected = [ "snow: ☃!", "xyz", "¡que!" ]; 311cb0ef41Sopenharmony_ci expected.push(expected.slice()); 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ci p.onValue = function (value) { 341cb0ef41Sopenharmony_ci t.deepEqual(value, expected.shift()); 351cb0ef41Sopenharmony_ci }; 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ci p.write('["snow: ☃!","xyz","¡que!"]'); 381cb0ef41Sopenharmony_ci}); 39