Skip to content

Commit

Permalink
RakuAST: add preliminary localization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 23, 2023
1 parent 06d9773 commit f6e7475
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 0 deletions.
16 changes: 16 additions & 0 deletions t/13-localization/basic.rakutest
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
21 changes: 21 additions & 0 deletions t/13-localization/sources/basic
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
12 changes: 12 additions & 0 deletions t/13-localization/sources/basic.DE
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
12 changes: 12 additions & 0 deletions t/13-localization/sources/basic.EN
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
12 changes: 12 additions & 0 deletions t/13-localization/sources/basic.FR
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
12 changes: 12 additions & 0 deletions t/13-localization/sources/basic.IT
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
12 changes: 12 additions & 0 deletions t/13-localization/sources/basic.NL
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

0 comments on commit f6e7475

Please sign in to comment.