-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RakuAST: add preliminary localization tests
- Loading branch information
Showing
7 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use v6.e.PREVIEW; | ||
use RakuAST::Deparse::L10N; | ||
use Test; | ||
|
||
plan +localizations; | ||
|
||
my $sources := $*PROGRAM.sibling("sources"); | ||
my $basic := $sources.add("basic").slurp; | ||
my $ast := $basic.AST; | ||
|
||
for localizations() { | ||
my $source := $sources.add("basic.$_").slurp; | ||
is $ast.DEPARSE($_), $source, "did the deparsing of $_ match"; | ||
} | ||
|
||
# vim: expandtab shiftwidth=4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file contains some very basic Raku code that serves as | ||
# a base for localizations. It is Raku code such as a programmer | ||
# would write, rather than how Raku would deparse this code in | ||
# English. | ||
|
||
my $a = 41; | ||
my $b = 666; | ||
|
||
if $a { | ||
$a++; | ||
} | ||
elsif $b { | ||
die "That is not the right number!"; | ||
} | ||
else { | ||
note "Shouldn't see this"; | ||
} | ||
|
||
say "incremented" if $a == 42; | ||
|
||
# vim: expandtab shiftwidth=4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mein $a = 41; | ||
mein $b = 666; | ||
wenn $a { | ||
$a++ | ||
} | ||
sonstwenn $b { | ||
sterb("That is not the right number!") | ||
} | ||
sonst { | ||
notiere("Shouldn't see this") | ||
} | ||
sag("incremented") wenn $a == 42 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
my $a = 41; | ||
my $b = 666; | ||
if $a { | ||
$a++ | ||
} | ||
elsif $b { | ||
die("That is not the right number!") | ||
} | ||
else { | ||
note("Shouldn't see this") | ||
} | ||
say("incremented") if $a == 42 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ma $a = 41; | ||
ma $b = 666; | ||
si $a { | ||
$a++ | ||
} | ||
ousi $b { | ||
meurs("That is not the right number!") | ||
} | ||
sinon { | ||
note("Shouldn't see this") | ||
} | ||
dis("incremented") si $a == 42 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
il-mio $a = 41; | ||
il-mio $b = 666; | ||
se $a { | ||
$a++ | ||
} | ||
altro-se $b { | ||
muori("That is not the right number!") | ||
} | ||
altro { | ||
nota("Shouldn't see this") | ||
} | ||
dillo("incremented") se $a == 42 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mijn $a = 41; | ||
mijn $b = 666; | ||
als $a { | ||
$a++ | ||
} | ||
andersals $b { | ||
sterf("That is not the right number!") | ||
} | ||
anders { | ||
merk-op("Shouldn't see this") | ||
} | ||
zeg("incremented") als $a == 42 |