From: Steve Hancock Date: Fri, 27 Nov 2020 19:32:03 +0000 (-0800) Subject: update testing utils to test with any version X-Git-Tag: 20201202~9 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=101bdb031d8daf75e6dbb8bce287f2718e4b2acf;p=perltidy.git update testing utils to test with any version --- diff --git a/t/snippets/perltidy_random_run.pl b/t/snippets/perltidy_random_run.pl index 9d61768a..2fa52819 100755 --- a/t/snippets/perltidy_random_run.pl +++ b/t/snippets/perltidy_random_run.pl @@ -74,6 +74,14 @@ my $do_syntax_check = $rsetup->{syntax_check}; my $delete_good_output = $rsetup->{delete_good_output}; my $FILES_file = $rsetup->{files}; my $PROFILES_file = $rsetup->{profiles}; +my $perltidy = $rsetup->{perltidy}; + +my $binfile = "perltidy"; +if ($perltidy) { + $binfile = "perl $perltidy"; +} + + $FILES_file = "FILES.txt" unless ($FILES_file); $PROFILES_file = "PROFILES.txt" unless ($PROFILES_file); @@ -183,7 +191,7 @@ for (my $nf=$nf_beg; $nf<=$nf_end; $nf++) { print STDERR "\n-----\nRun '$nf.$np' : profile='$profile', ifile='$ifile'\n"; - my $cmd = "perltidy <$ifile >$ofile -pro=$profile"; + my $cmd = "$binfile <$ifile >$ofile -pro=$profile"; print STDERR "$cmd\n"; system $cmd; my $efile = "perltidy.ERR"; diff --git a/t/snippets/perltidy_random_setup.pl b/t/snippets/perltidy_random_setup.pl index 274e81e7..e7e85073 100755 --- a/t/snippets/perltidy_random_setup.pl +++ b/t/snippets/perltidy_random_setup.pl @@ -11,6 +11,7 @@ our $rsetup; # the setup hash my $config_file = "config.txt"; my $FILES_file = "FILES.txt"; my $PROFILES_file = "PROFILES.txt"; +my $perltidy = ""; my $rfiles = []; my $rprofiles = []; @@ -73,6 +74,8 @@ while (1) { my $chain_mode = $rsetup->{chain_mode}; my $do_syntax_check = $rsetup->{syntax_check}; my $delete_good_output = $rsetup->{delete_good_output}; + my $perltidy_version = $rsetup->{perltidy}; + $perltidy_version = "[default]" unless ($perltidy_version); print <{syntax_check} = $do_syntax_check; } + elsif ( $ans eq 'V' ) { + my $test = + query("Enter the full path to the perltidy binary, or for default"); + if ( $test && !-e $test ) { + next + unless ( + ifyes("I cannot find that, do you want to use it anyway?") ); + } + $rsetup->{perltidy} = $test; + } elsif ( $ans eq 'Q' ) { last if ( ifyes("Quit without saving? [Y/N]") ); } @@ -275,6 +289,7 @@ sub default_config { syntax_check => 0, profiles => $PROFILES_file, files => $FILES_file, + perltidy => $perltidy, }; return; } @@ -298,7 +313,8 @@ unlink $0; nohup nice -n19 perltidy_random_run.pl >>nohup.my 2>>nohup.my EOM system("chmod +x $runme"); - print STDOUT "now enter ./$runme\n"; + print STDOUT "Edit $config_file if you want to make any changes\n"; + print STDOUT "then enter ./$runme\n"; } sub write_config {