From: Shawn M Moore Date: Mon, 22 Aug 2011 20:19:52 +0000 (-0400) Subject: Basic test for meta_lookup X-Git-Tag: 2.0300~106 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58c2edea043a773df6447dc8f601166650ee344f;p=gitmo%2FMoose.git Basic test for meta_lookup --- diff --git a/t/metaclasses/exporter_meta_lookup.t b/t/metaclasses/exporter_meta_lookup.t new file mode 100644 index 0000000..504f775 --- /dev/null +++ b/t/metaclasses/exporter_meta_lookup.t @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +{ + package Class::Vacuum::Innards; + use Moose; + + package Class::Vacuum; + use Moose (); + use Moose::Exporter; + + BEGIN { + Moose::Exporter->setup_import_methods( + also => 'Moose', + meta_lookup => sub { Class::MOP::class_of('Class::Vacuum::Innards') }, + ); + } +} + +{ + package Victim; + BEGIN { Class::Vacuum->import }; + + has star_rod => ( + is => 'ro', + ); +} + +ok(Class::Vacuum::Innards->can('star_rod'), 'Vacuum stole the star_rod method'); +ok(!Victim->can('star_rod'), 'Victim does not get it at all'); + +done_testing; +