File: 20_authors_with_special_characters.t

package info (click to toggle)
libmodule-install-perl 1.21-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 636 kB
  • sloc: perl: 3,569; makefile: 13
file content (138 lines) | stat: -rw-r--r-- 2,947 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use Test::More;
use File::Spec;
use Parse::CPAN::Meta;
use lib 't/lib';
use MyTest;

plan tests => 26;

require ExtUtils::MakeMaker;
my $eumm = eval $ExtUtils::MakeMaker::VERSION;

SCOPE: {
	ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name          'Foo';
perl_version  '5.005';
version       '0.01';
license       'perl';
all_from      'lib/Foo.pm';
WriteAll;
END_DSL

	ok( add_file(qw(lib Foo.pm), <<'END') );
package Foo;
1;
\__END__

\=head1 NAME

Foo - Abstract

\=head1 AUTHOR

First 'Middle' Last

\=cut
END

	ok( build_dist(), 'build_dist' );
	my $file = makefile();
	ok(-f $file);
	my $content = _read($file);
	ok($content, 'file is not empty');
	ok($content =~ author_makefile_re("First 'Middle' Last"), 'has one author') or do {
	  $content =~ /^(#\s*AUTHOR => .*?)$/m;
	  diag "String: $1";
	};
	my $metafile = file('META.yml');
	ok(-f $metafile);
	my $meta = Parse::CPAN::Meta::LoadFile($metafile);
	is_deeply($meta->{author}, [qq(First 'Middle' Last)]);
	ok( kill_dist(), 'kill_dist' );
}

if ($] >= 5.008) {
	eval "use utf8";
	SCOPE: {
		ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name          'Foo';
perl_version  '5.005';
version       '0.01';
license       'perl';
all_from      'lib/Foo.pm';
WriteAll;
END_DSL

		ok( add_file(qw(lib Foo.pm), <<'END') );
package Foo;
1;
\__END__

\=head1 NAME

Foo - Abstract

\=head1 AUTHOR

Olivier MenguE<eacute>

\=cut
END

		ok( build_dist(), 'build_dist' );
		my $file = makefile();
		ok(-f $file);
		my $content = _read($file);
		ok($content, 'file is not empty');
    TODO: {
      local $TODO = 'EUMM 7.00 fixed unicode but we have not' if $eumm gt '6.98';
		  ok($content =~ author_makefile_re("Olivier Mengu\xE9"), 'has one author');
    }
		my $metafile = file('META.yml');
		ok(-f $metafile);
		my $meta = Parse::CPAN::Meta::LoadFile($metafile);
		is_deeply($meta->{author}, [q(Olivier Mengu\xE9)]);
		ok( kill_dist(), 'kill_dist' );
	}

	SCOPE: {
		ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name          'Foo';
perl_version  '5.005';
version       '0.01';
license       'perl';
author        "Olivier Mengu\xE9";
all_from      'lib/Foo.pm';
WriteAll;
END_DSL

		ok( build_dist(), 'build_dist' );
		my $file = makefile();
		ok(-f $file);
		my $content = _read($file);
		ok($content, 'file is not empty');
    TODO: {
      local $TODO = 'EUMM 7.00 fixed unicode but we have not' if $eumm gt '6.98';
		  ok($content =~ author_makefile_re("Olivier Mengu\xE9"), 'has one author');
    }
		my $metafile = file('META.yml');
		ok(-f $metafile);
		my $meta = Parse::CPAN::Meta::LoadFile($metafile);
		is_deeply($meta->{author}, [q(Olivier Mengu\xE9)]);
		ok( kill_dist(), 'kill_dist' );
	}
}
else {
	SKIP: {
		skip "this test requires perl 5.8", 17;
	}
}