%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /root/.cpanm/work/1590825950.14464/YAML-Syck-1.32/t/bug/
Upload File :
Create Path :
Current File : //root/.cpanm/work/1590825950.14464/YAML-Syck-1.32/t/bug/rt-54167.t

#!/usr/bin/env perl

use warnings;
use strict;

use Test::More tests => 2;

use YAML::Syck;

my $some_hashref = { a => 1, b => 2 };
my $expected_iterations = scalar keys %$some_hashref;

is(
    count_each_iterations($some_hashref),
    $expected_iterations,
    "each() iterates properly before YAML::Syck::Dump",
);

# Perform the Dump.
my $some_yaml_dump = YAML::Syck::Dump($some_hashref);

is(
    count_each_iterations($some_hashref),
    $expected_iterations,
    "each() iterates properly after YAML::Syck::Dump",
);

exit;

sub count_each_iterations {
    my $hashref = shift;

    my $iterations = 0;
    while ( my ( $k, $v ) = each %$hashref ) {
        $iterations++;
    }

    return $iterations;
}

Zerion Mini Shell 1.0