Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests for .fc.
Including the various tricky cases.
  • Loading branch information
jnthn committed Oct 8, 2015
1 parent c8e924a commit 7f75447
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions S32-str/fc.t
@@ -0,0 +1,27 @@
use Test;

plan 12;

# Simple
is 'BEEF \o/'.fc, 'beef \o/', '.fc on simple string in ASCII range works';
is 'ÝØÛ SMĚŁŁ'.fc, 'ýøû směłł', '.fc on string with non-growing case fold';

# Growing to multiple graphemes
is 'Scheiße!'.fc, 'scheisse!', '.fc on ß expands to ss';
is 'fish ʼn chips'.fc, 'fish ʼn chips', '.fc on ʼn expands to ʼn';
is 'Leffe'.fc, 'leffe', 'ligature ff expands to ff on foldcase';
is 'Efficient'.fc, 'efficient', 'ligature ffi expands to ffi on foldcase';

# Curious cases where a foldcase does expand to a base and combiner, but NFC
# (not even NFG) actually restores it, making it a no-op for NFG strings.
is 'ǰnthn'.fc, 'ǰnthn', 'ǰ foldcases to identity under NFG (1 combiner)';
is 'pΐvo'.fc, 'pΐvo', 'ΐ foldcases to identity under NFG (2 combiners)';

# Cases where foldcase expands to precomposed and another base.
is 'BᾈR'.fc, 'bἀιr', 'ᾈ foldcases to ἀι';
is 'BᾈR'.fc.chars, 4, 'ᾈ -> ἀι = 1 extra char';

# Case where foldcase expands to base, combiner, base, and we need to compose
# the first two to maintain NFG.
is 'oῷ!'.fc, 'oῶι!', 'ῷ foldcases to ῶι';
is 'oῷ!'.fc.chars, 4, 'ῷ -> ῶι = 1 extra char';

0 comments on commit 7f75447

Please sign in to comment.