Hardware-Vhdl-Tidy

 view release on metacpan or  search on metacpan

t/tidy_commandline.t  view on Meta::CPAN

        binmode $fh;
		print $fh @{$untidy_ref};
		close $fh;
	}

	# open new temp. for output
	my $fho = tempfile;
    #open $fho, '+>', 'test_out.vhd' || die $!;
    binmode $fho;
	{
		local @ARGV = (@{$args->{switches}}, $infile);
        open my $oldout, '>&STDOUT' or die "Can't dup STDOUT: $!";
		my $restore_old_fh = AtExit->new( sub { open STDOUT, ">&", $oldout or die "Can't dup \$oldout: $!"; } );
        open STDOUT, '>&', $fho or die "Can't redirect STDOUT: $!";
        select STDOUT; $| = 1;      # make unbuffered
		Hardware::Vhdl::Tidy::parse_commandline();
        $restore_old_fh = undef;
	}
    if ($args->{inplace}) {
        seek $fho, 0, 2; # go to the end of the output file so that we can find out how much output there was
        is(tell $fho, 0, $args->{test_description}.': nothing written to STDOUT');



( run in 1.129 second using v1.01-cache-2.11-cpan-49f99fa48dc )