From a8ef25b6d681806d76867a0335610cc9ebb64846 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 5 Oct 2021 06:19:36 -0700 Subject: [PATCH] be sure DEVEL_MODE is set for random testing --- dev-bin/perltidy_random_setup.pl | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/dev-bin/perltidy_random_setup.pl b/dev-bin/perltidy_random_setup.pl index d3696fc8..9b4da0a5 100755 --- a/dev-bin/perltidy_random_setup.pl +++ b/dev-bin/perltidy_random_setup.pl @@ -40,7 +40,10 @@ else { } } -# TODO: see if DEVEL_MODE is set, turn it on if not +# see if DEVEL_MODE is set, turn it on if not +if ($perltidy eq "./perltidy.pl") { + check_DEVEL_MODE($perltidy); +} query(<) { + my $line = $_; + if ( $line =~ + /^(\s*use\s+constant\s+(?:DEVEL)_[A-Z]+\s*)=>\s*(-?\d*);(.*)$/ ) + { + if ( $2 != '1' ) { + $changed_count++; + $line = < 1;$3 +EOM + } + } + push @output, $line; + } + $fh->close(); + + if ( $changed_count && @output ) { + my $fh_out; + open( $fh_out, '>', $fname ) + or die "can't open '$fname' : $!\n"; + foreach (@output) { + $fh_out->print($_); + } + $fh_out->close(); + print STDERR "Changed to DEVEL_MODE => 1\n"; + } +} -- 2.39.5