Commit 57ea6d26 authored by twanvl's avatar twanvl

testset: ignore locale errors (except in a single testcase for them),...

testset: ignore locale errors (except in a single testcase for them), otherwise all tests fail when there is an error in the locale
parent 7dd3ff67
...@@ -13,13 +13,17 @@ use TestFramework; ...@@ -13,13 +13,17 @@ use TestFramework;
# The tests # The tests
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
test_case("script/Locale Errors?", sub{
run_script_test("test-blank.mse-script", ignore_locale_errors => 0);
});
test_case("script/Builtin Funcions", sub{ test_case("script/Builtin Funcions", sub{
run_script_test("test-builtin.mse-script", ""); run_script_test("test-builtin.mse-script");
}); });
test_case("script/Magic Funcions", sub{ test_case("script/Magic Funcions", sub{
write_dummy_set("_dummy-magic-set.mse-set", "game: magic\nstylesheet: new\n"); write_dummy_set("_dummy-magic-set.mse-set", "game: magic\nstylesheet: new\n");
run_script_test("test-magic.mse-script", "_dummy-magic-set.mse-set"); run_script_test("test-magic.mse-script", set => "_dummy-magic-set.mse-set");
remove_dummy_set("_dummy-magic-set.mse-set"); remove_dummy_set("_dummy-magic-set.mse-set");
}); });
......
...@@ -59,7 +59,7 @@ sub test_stylesheet { ...@@ -59,7 +59,7 @@ sub test_stylesheet {
file_set_contents($script, "write_image_file(set.cards[0],file:\"cards-out/blank-$basename.png\");1"); file_set_contents($script, "write_image_file(set.cards[0],file:\"cards-out/blank-$basename.png\");1");
# Run! # Run!
run_script_test($script, "\"$setname\""); run_script_test($script, set => $setname);
# Cleanup # Cleanup
remove_dummy_set($setname); remove_dummy_set($setname);
......
...@@ -31,7 +31,9 @@ if ($is_windows) { ...@@ -31,7 +31,9 @@ if ($is_windows) {
# Invoke a script # Invoke a script
sub run_script_test { sub run_script_test {
my $script = shift; my $script = shift;
my $args = shift; my %opts = @_;
my $args = defined($opts{set}) ? "\"$opts{set}\"" : '';
my $ignore_locale_errors = $opts{ignore_locale_errors} // 1;
my $outfile = basename($script,".mse-script") . ".out"; my $outfile = basename($script,".mse-script") . ".out";
my $command = "$MAGICSETEDITOR --cli --quiet --script \"$script\" $args > \"$outfile\""; my $command = "$MAGICSETEDITOR --cli --quiet --script \"$script\" $args > \"$outfile\"";
print "$command\n"; print "$command\n";
...@@ -44,7 +46,7 @@ sub run_script_test { ...@@ -44,7 +46,7 @@ sub run_script_test {
if (/^(WARNING|ERROR)/) { if (/^(WARNING|ERROR)/) {
print $_; print $_;
$in_error = 1; $in_error = 1;
fail_current_test(); fail_current_test() unless (/in locale file/ && $ignore_locale_errors);
} elsif ($in_error) { } elsif ($in_error) {
if (/^ /) { if (/^ /) {
print $_; print $_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment