This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Create a block around some code; indent
[perl5.git] / t / porting / ss_dup.t
1 #!perl
2
3 @TODO = qw [ SAVEt_SAVESWITCHSTACK ];
4 @TODO{@TODO} = ();
5
6 BEGIN { chdir 't'; @INC = "../lib"; require './test.pl' }
7 use Config;
8
9 if ( $Config{usecrosscompile} ) {
10   skip_all( "Not all files are available during cross-compilation" );
11 }
12
13 sub read_cases {
14   my ($file, $func) = @_;
15
16   open my $fh, $file or die "$0 cannot open $file: $!";
17
18   while (readline $fh) {
19     last if /^Perl_$func/;
20   }
21   my %found;
22   while (readline $fh) {
23     last if /^}/;
24     $found{$1}++ if /case (SAVEt_\w*):/;
25   }
26   close $fh or die "$0 cannot close $file: $!";
27   \%found;
28 }
29
30 my $leave_scope = read_cases "../scope.c", "leave_scope";
31 my $ss_dup      = read_cases "../sv.c",    "ss_dup";
32
33 ok scalar %$leave_scope, 'we got some';
34
35 for (sort keys %$leave_scope) {
36   local $::TODO = ' ' if exists $TODO{$_};
37   ok exists $$ss_dup{$_}, "ss_dup handles $_";
38 }
39
40 done_testing;