Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t] Added named arg tests for ord and chr

git-svn-id: http://svn.pugscode.org/pugs@25106 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 1b6d1d03ce6f08681c4158f18d101fdefb563177 1 parent c820a0a
frew authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 S29-conversions/ord_and_chr.t
View
11 S29-conversions/ord_and_chr.t
@@ -121,7 +121,7 @@ my @maps = (
"\o03", 3,
);
-plan 36+@maps;
+plan 36+@maps*2;
for @maps -> $char, $code {
my $descr = "\\{$code}{$code >= 32 ?? " == '{$char}'" !! ""}";
@@ -129,6 +129,14 @@ for @maps -> $char, $code {
is chr($code), $char, "chr() works for $descr";
}
+for @maps -> $char, $code {
+ my $descr = "\\{$code}{$code >= 32 ?? " == '{$char}'" !! ""}";
+#?rakudo skip 'named args'
+ is ord(:string($char)), $code, "ord() works for $descr with named args";
+#?rakudo skip 'named args'
+ is chr(:graph($code)), $char, "chr() works for $descr with named args";
+}
+
for 0..31 -> $code {
my $char = chr($code);
is ord($char), $code, "ord(chr($code)) is $code";
@@ -140,3 +148,4 @@ is 65.chr, 'A', "there's a .chr method";
#?rakudo 2 skip 'multi-arg variants of ord and chr not in place yet'
is ord('hello'), [104, 101, 108, 108, 111], 'ord works with longer strings';
is chr(104, 101, 108, 108, 111), 'hello', 'chr works with a list of ints';
+#vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.