403Webshell
Server IP : 164.138.27.172  /  Your IP : 216.73.216.143
Web Server : nginx/1.27.4
System : Linux cookingdream 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : www-adm ( 1001)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/jonasn/.cpan/build/Text-Diff-1.45-0/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/jonasn/.cpan/build/Text-Diff-1.45-0/t/outputs.t
#!/usr/bin/perl

use strict;
use Test;
use Text::Diff;

my @A = map "$_\n", qw( 1 2 3 4 );
my @B = map "$_\n", qw( 1 2 3 5 );

sub _d($) {
	diff \@A, \@B, { OUTPUT => shift };
}

sub slurp {
	open SLURP, "<$_[0]" or die $!;
	my $string = join "", <SLURP>;
	close SLURP;
	return $string;
}

my $expected = _d undef;

my @tests = (
	sub {
		ok $expected =~ tr/\n//
	},
	sub {
		my $o;
		_d sub { $o .= shift };
		ok $o, $expected
	},
	sub {
		my @o;
		_d \@o;
		ok join( "", @o ), $expected;
	},
	sub {
		open F, ">output.foo" or die $!;
		_d \*F;
		close F or die $!;
		ok slurp "output.foo", $expected;
		unlink "output.foo" or warn $!;
	},
	sub {
		require IO::File;
		my $fh = IO::File->new( ">output.bar" );
		_d $fh;
		$fh->close;
		$fh = undef;
		ok slurp "output.bar", $expected;
		unlink "output.bar" or warn $!;
	},
	sub {
		ok 0 < index( diff( \"\n", \"", { STYLE => "Table" } ), "\\n" );
	},

	# Test for bug reported by Ilya Martynov <ilya@martynov.org> 
	sub {
		ok diff( \"", \"" ), "";
	},
	sub {
		ok diff( \"A", \"A" ), "";
	},
);

plan tests => scalar @tests;

$_->() for @tests;

Youez - 2016 - github.com/yon3zu
LinuXploit