Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some tests for various methods on Uni.
  • Loading branch information
jnthn committed Apr 24, 2015
1 parent f4f5735 commit 588ebf6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions S15-string-types/Uni.t
@@ -0,0 +1,25 @@
use Test;

plan 15;

my $uni = Uni.new(0x0044, 0x0307, 0x0323);

is $uni.codes, 3, '.codes works on a Uni';
is $uni.elems, 3, '.elems works on a Uni';
is +$uni, 3, 'numifying a Uni gives number of elems';
is $uni.Int, 3, 'Int-ifying a Uni gives number of elems';
is $uni.list, (0x0044, 0x0307, 0x0323), '.list works on a Uni';

is $uni[0], 0x0044, 'array indexing works on a Uni (1)';
is $uni[1], 0x0307, 'array indexing works on a Uni (2)';
is $uni[2], 0x0323, 'array indexing works on a Uni (3)';

ok $uni[0]:exists, 'exists works on Uni (1)';
ok $uni[2]:exists, 'exists works on Uni (2)';
nok $uni[3]:exists, 'exists works on Uni (3)';

is $uni.perl, 'Uni.new(0x0044, 0x0307, 0x0323)', '.perl works on Uni';
is $uni.gist, 'Uni:0x<0044 0307 0323>', '.gist works on Uni';

ok $uni, 'A non-empty Uni boolifies to true';
nok Uni.new, 'An empty Uni boolifies to false';

0 comments on commit 588ebf6

Please sign in to comment.