utf8.js 705 B

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