#!/usr/bin/perl use strict; use warnings; =head1 NAME build-test-scripts - rebuild t/*.t from t/*.ttmpl =head1 SYNOPSIS t/build-test-scripts =head1 DESCRIPTION When run from the root of the IO::Callback distribution, this script rebuilds some of the test files in F from test template files in the same directory. Each test template gives rise to one or more test files, with a test file generated for each possible combination of values for the C directives in the template. =cut use autodie; use File::Slurp; use File::Spec; use Template; our $tt =Template->new({ START_TAG => '<<<', END_TAG => '>>>', }); my $dirhandle; opendir $dirhandle, "t"; while ( my $f = readdir $dirhandle ) { next unless $f =~ m{^(.+)\.ttmpl$}; my $base_test_name = $1; my $src_filename = File::Spec->catfile("t", $f); my $auto_warning = < $value }); } } sub output_test_script { my ($test_name, $input, $vars) = @_; my $outfile = File::Spec->catfile("t", "$test_name.t"); $tt->process(\$input, $vars, $outfile) or die "Template $outfile: ".$tt->error; }