source: trip-planner-front/node_modules/jsonparse/test/utf8.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 705 bytes
Line 
1var test = require('tape');
2var Parser = require('../');
3
4test('3 bytes of utf8', function (t) {
5 t.plan(1);
6
7 var p = new Parser();
8 p.onValue = function (value) {
9 t.equal(value, '├──');
10 };
11
12 p.write('"├──"');
13});
14
15test('utf8 snowman', function (t) {
16 t.plan(1);
17
18 var p = new Parser();
19 p.onValue = function (value) {
20 t.equal(value, '☃');
21 };
22
23 p.write('"☃"');
24});
25
26test('utf8 with regular ascii', function (t) {
27 t.plan(4);
28
29 var p = new Parser();
30 var expected = [ "snow: ☃!", "xyz", "¡que!" ];
31 expected.push(expected.slice());
32
33 p.onValue = function (value) {
34 t.deepEqual(value, expected.shift());
35 };
36
37 p.write('["snow: ☃!","xyz","¡que!"]');
38});
Note: See TracBrowser for help on using the repository browser.