App-Greple-tee

 view release on metacpan or  search on metacpan

t/01_autoload.t  view on Meta::CPAN

sub test_func { return 42 }
$code = resolve('main::test_func');
is ref($code), 'CODE', 'resolve returns CODE ref for main::test_func';
is $code->(), 42, 'resolved function works correctly';

# Test resolve dies on undefined function
eval { resolve('No::Such::Module::no_such_func') };
like $@, qr/Undefined function|Can't locate/, 'resolve dies on undefined function';

# Test alias resolution (without actually loading modules)
# Just verify the aliases are defined by checking they don't die immediately
# when the module loading fails (they should try to load the module)
for my $alias (qw(ansicolumn ansifold cat-v)) {
    eval { resolve($alias) };
    # Should either succeed or fail with module load error, not "Undefined function"
    unlike $@, qr/^Undefined function: \Q$alias\E/,
        "alias '$alias' is recognized (may fail on module load)";
}

# Test actual function resolution if modules are installed
SKIP: {



( run in 0.737 second using v1.01-cache-2.11-cpan-13bb782fe5a )