Last active
August 29, 2015 14:02
-
-
Save peschwa/661c66d89243b343ce20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./perl6 trans.t | |
1..10 | |
ok 1 - Plaintext for $left and $right works. | |
ok 2 - Plaintext for $left and \x for $right works. | |
ok 3 - \x for $left and plaintext for $right works. | |
ok 4 - \x for $left and $right works. | |
ok 5 - No interpolation for $right. | |
ok 6 - No interpolation for $left. | |
ok 7 - First Pair is the one used for substitution. | |
ok 8 - Range on both sides works. | |
ok 9 - Different delimiter with range works. | |
ok 10 - Bunch of stuff together - what an informal test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Test; | |
plan 10; | |
my $f = 'abc'; | |
$f ~~ tr/a/b/; | |
is $f, 'bbc', "Plaintext for \$left and \$right works."; | |
$f = 'bbc'; | |
$f ~~ tr/b/\x61/; | |
is $f, 'aac', "Plaintext for \$left and \\x for \$right works."; | |
$f = 'aac'; | |
$f ~~ tr/\x61/d/; | |
is $f, 'ddc', "\\x for \$left and plaintext for \$right works."; | |
$f = 'ddc'; | |
$f ~~ tr/\x64/\x61/; | |
is $f, 'aac', "\\x for \$left and \$right works."; | |
$f = 'ddc'; | |
$f ~~ tr/dc/$x/; | |
is $f, '$$x', "No interpolation for \$right."; | |
$f = '$$x'; | |
$f ~~ tr/$x/a/; | |
is $f, 'aaa', "No interpolation for \$left."; | |
$f = 'aaa'; | |
$f ~~ tr/aaa/bcd/; | |
is $f, 'bbb', "First Pair is the one used for substitution."; | |
$f = 'abcdef'; | |
$f ~~ tr/a..f/g..l/; | |
is $f, 'ghijkl', "Range on both sides works."; | |
$f = 'abc'; | |
$f ~~ tr[a..c][d..f]; | |
is $f, 'def', "Different delimiter with range works."; | |
$f = 'abcdef'; | |
$f ~~ tr[a..c\x64\c[LATIN SMALL LETTER E]\o146][ghijkl]; | |
is $f, 'ghijkl', 'Bunch of stuff together - what an informal test.'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment