Skip to content

Commit

Permalink
Add test for #15
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Apr 16, 2022
1 parent fb8e2f0 commit a0cca1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const expect = require('unexpected')
fieldName
);
}
)
.addAssertion(
'<Buffer> [not] to include code point <number>',
async (expect, fontBuffer, codePoint) => {
expect.errorMode = 'nested';
expect(
fontkit.create(fontBuffer).characterSet,
'[not] to contain',
codePoint
);
}
);
const subsetFont = require('..');
const fontverter = require('fontverter');
Expand Down Expand Up @@ -93,6 +104,15 @@ describe('subset-font', function () {
await expect(this.result, 'to include name field', 'licenseURL');
});
});

// https://github.com/papandreou/subset-font/issues/15
it('should handle surrogate pairs', async function () {
const emojiFont = await readFile(
pathModule.resolve(__dirname, '..', 'testdata', 'emoji.ttf')
);
const result = await subsetFont(emojiFont, '\u{1d11e}'); // aka '\ud834\udd1e'
await expect(result, 'to include code point', 0x1d11e);
});
});

describe('with a woff font', function () {
Expand Down
Binary file added testdata/emoji.ttf
Binary file not shown.

0 comments on commit a0cca1e

Please sign in to comment.