From: Marius Gavrilescu Date: Wed, 23 Apr 2014 08:07:29 +0000 (+0300) Subject: Reindent t/01-jobs.t X-Git-Tag: 5999.000_003~7 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=197cd6a325653b82e59eb0d842a42b944b345109;p=gruntmaster-daemon.git Reindent t/01-jobs.t --- diff --git a/t/01-jobs.t b/t/01-jobs.t index 32f299b..23a6c35 100644 --- a/t/01-jobs.t +++ b/t/01-jobs.t @@ -31,18 +31,18 @@ Log::Log4perl->init(\$log_conf); $ENV{PATH}.=':' . cwd; sub check_job{ - my $job = shift; - my $jobh = get_job $job; - my $meta = job_inmeta $job; - $meta->{result} = $jobh->{result}; - $meta->{result_text} = $jobh->{result_text}; - $meta->{results} = $jobh->{results}; - if (defined $meta->{results}) { - delete $meta->{results}[$_]{time} for keys $meta->{results}; - } - is $meta->{result}, $meta->{expected_result}, "Result is correct"; - is $meta->{result_text}, $meta->{expected_result_text}, "Result text is correct"; - is_deeply $meta->{results}, $meta->{expected_results}, "Results are correct"; + my $job = shift; + my $jobh = get_job $job; + my $meta = job_inmeta $job; + $meta->{result} = $jobh->{result}; + $meta->{result_text} = $jobh->{result_text}; + $meta->{results} = $jobh->{results}; + if (defined $meta->{results}) { + delete $meta->{results}[$_]{time} for keys $meta->{results}; + } + is $meta->{result}, $meta->{expected_result}, "Result is correct"; + is $meta->{result_text}, $meta->{expected_result_text}, "Result text is correct"; + is_deeply $meta->{results}, $meta->{expected_results}, "Results are correct"; } my @problems = exists $ENV{TEST_PROBLEMS} ? map {"t/problems/$_"} split ' ', $ENV{TEST_PROBLEMS} : ; @@ -54,32 +54,32 @@ my $tempdir = tempdir CLEANUP => 1; my $job = 0; for my $problem (@problems) { - my $meta = LoadFile "$problem/meta.yml"; - for (1 .. $meta->{testcnt}) { - $meta->{infile}[$_ - 1] = read_file "$problem/$_.in" if $meta->{generator} eq 'File'; - $meta->{okfile}[$_ - 1] = read_file "$problem/$_.ok" if $meta->{runner} eq 'File'; - } - if (exists $meta->{files}) { - $_->{content} = read_file "$problem/$_->{name}" for values $meta->{files} - } - set_problem_meta scalar fileparse($problem), $meta; + my $meta = LoadFile "$problem/meta.yml"; + for (1 .. $meta->{testcnt}) { + $meta->{infile}[$_ - 1] = read_file "$problem/$_.in" if $meta->{generator} eq 'File'; + $meta->{okfile}[$_ - 1] = read_file "$problem/$_.ok" if $meta->{runner} eq 'File'; + } + if (exists $meta->{files}) { + $_->{content} = read_file "$problem/$_->{name}" for values $meta->{files} + } + set_problem_meta scalar fileparse($problem), $meta; - TODO: { - local $TODO = $meta->{todo} if exists $meta->{todo}; - note "Now testing problem $meta->{name} ($meta->{description})"; + TODO: { + local $TODO = $meta->{todo} if exists $meta->{todo}; + note "Now testing problem $meta->{name} ($meta->{description})"; - for my $source (<$problem/tests/*>) { - my $meta = LoadFile "$source/meta.yml"; - $meta->{files}{prog}{content} = read_file "$source/$meta->{files}{prog}{name}"; - $job++; - set_job_inmeta $job, $meta; - set_job_problem $job, scalar fileparse $problem; - note "Running $meta->{test_name} ($meta->{test_description})..."; - my $savedcwd = cwd; - chdir $tempdir; - Gruntmaster::Daemon::process $job; - check_job $job; - chdir $savedcwd; + for my $source (<$problem/tests/*>) { + my $meta = LoadFile "$source/meta.yml"; + $meta->{files}{prog}{content} = read_file "$source/$meta->{files}{prog}{name}"; + $job++; + set_job_inmeta $job, $meta; + set_job_problem $job, scalar fileparse $problem; + note "Running $meta->{test_name} ($meta->{test_description})..."; + my $savedcwd = cwd; + chdir $tempdir; + Gruntmaster::Daemon::process $job; + check_job $job; + chdir $savedcwd; + } } - } }