surrogate.js 451 B

1234567891011121314151617181920212223242526
  1. var test = require('tape');
  2. var Parser = require('../');
  3. test('parse surrogate pair', function (t) {
  4. t.plan(1);
  5. var p = new Parser();
  6. p.onValue = function (value) {
  7. t.equal(value, '😋');
  8. };
  9. p.write('"\\uD83D\\uDE0B"');
  10. });
  11. test('parse chunked surrogate pair', function (t) {
  12. t.plan(1);
  13. var p = new Parser();
  14. p.onValue = function (value) {
  15. t.equal(value, '😋');
  16. };
  17. p.write('"\\uD83D');
  18. p.write('\\uDE0B"');
  19. });