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