Data-Intern-Shared

 view release on metacpan or  search on metacpan

t/04-frozen.t  view on Meta::CPAN

    ok $anon->frozen,   'anonymous table can be frozen';
    ok $anon->readonly, 'freezing an anonymous handle makes it read-only';
    is $anon->string($id), "anon-str",       'anonymous frozen table still queryable (string)';
    is $anon->id_of("anon-str"), $id,        'anonymous frozen table still queryable (id_of)';
    ok $anon->exists("anon-str"),            'anonymous frozen table still queryable (exists)';
    like exception(sub { $anon->intern("more") }), qr/read-only/, 'mutating a frozen anonymous table croaks';
}

done_testing;

# minimal exception helper (avoid a Test::Fatal dependency)
sub exception {
    my $code = shift;
    my $err;
    { local $@; eval { $code->(); 1 } or $err = $@; }
    return $err;
}



( run in 1.666 second using v1.01-cache-2.11-cpan-54e63673c56 )