Skip to content

Commit

Permalink
Add leading number and spaces tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iansw246 committed Oct 25, 2023
1 parent 3616bd8 commit c1f8bdd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export function run() {
t.is(generateName('ABcd', usedNames), 'ABcd')
t.is(generateName('$Abc_123', usedNames), '$Abc_123')
t.is(generateName('Abc-de-f', usedNames), 'AbcDeF')
t.is(generateName(' 412Abc-de-f', usedNames), '_412AbcDeF')

// Unicode tests. See https://mathiasbynens.be/notes/javascript-identifiers-es6 to confirm results
t.is(generateName('呵呵', usedNames), '呵呵')
t.is(generateName('Abc 𝄇 de-fg', usedNames), 'AbcDeFg')
t.is(generateName('abc 𝄇 de-fg', usedNames), 'AbcDeFg')
t.is(generateName('Abcಠ_ಠde-fgh๏_๏', usedNames), 'Abcಠ_ಠdeFgh_')
t.is(generateName('ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ', usedNames), 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ')
t.is(generateName('ÄÖÉÜß', usedNames), 'ÄÖÉÜß')
Expand All @@ -29,7 +30,7 @@ export function run() {
// Emoji flags use two regional indicator symbols
t.is(generateName('🇳🇵 Emoji flags 🇦🇩', usedNames), 'EmojiFlags')
// Regional flags like England use emoji tag sequences
t.is(generateName('🏴󠁧󠁢󠁥󠁮󠁧󠁿 England 🏴󠁧󠁢󠁳󠁣󠁴󠁿', usedNames), 'England')
t.is(generateName(' 🏴󠁧󠁢󠁥󠁮󠁧󠁿 england 🏴󠁧󠁢󠁳󠁣󠁴󠁿', usedNames), 'England')

// Index should increment:
t.is(generateName('a', usedNames), 'A1')
Expand Down

0 comments on commit c1f8bdd

Please sign in to comment.