Upgrade to Parse::CPAN::Meta 1.38
[p5sagit/p5-mst-13.2.git] / lib / Parse / CPAN / Meta / t / 21_bom.t
1 #!/usr/bin/perl
2
3 BEGIN {
4         if( $ENV{PERL_CORE} ) {
5                 chdir 't';
6                 @INC = ('../lib', 'lib');
7         }
8         else {
9                 unshift @INC, 't/lib/';
10         }
11 }
12
13 use strict;
14 BEGIN {
15         $|  = 1;
16         $^W = 1;
17 }
18
19 use File::Spec::Functions ':ALL';
20 use Parse::CPAN::Meta::Test;
21 use Test::More tests(0, 1, 3);
22
23
24
25
26
27 #####################################################################
28 # Testing that Perl::Smith config files work
29
30 my $sample_file = catfile( test_data_directory(), 'utf_16_le_bom.yml' );
31 my $sample      = load_ok( 'utf_16_le_bom.yml', $sample_file, 3 );
32
33 # Does the string parse to the structure
34 my $name      = "utf-16";
35 my $yaml_copy = $sample;
36 my $yaml      = eval { Parse::CPAN::Meta::Load( $yaml_copy ); };
37 is( $yaml_copy, $sample, "$name: Parse::CPAN::Meta::Load does not modify the input string" );
38 is( $yaml, undef, "file not parsed" );
39 ok( $@ =~ "Stream has a non UTF-8 Unicode Byte Order Mark", "correct error" );