Add a failing testcase for get_all_package_symbols and inlined constants.
Florian Ragwitz [Fri, 14 Nov 2008 21:04:42 +0000 (21:04 +0000)]
t/304_constant_codeinfo.t [new file with mode: 0644]

diff --git a/t/304_constant_codeinfo.t b/t/304_constant_codeinfo.t
new file mode 100644 (file)
index 0000000..3f907fa
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN {
+    use_ok('Class::MOP');
+}
+
+{
+    package Foo;
+    use constant FOO => 'bar';
+}
+
+my $meta = Class::MOP::Class->initialize('Foo');
+
+my %syms = $meta->get_all_package_symbols('CODE');
+is(ref $syms{FOO}, 'CODE', 'get constant symbol');
+
+undef %syms;
+
+%syms = $meta->get_all_package_symbols('CODE');
+is(ref $syms{FOO}, 'CODE', 'constant symbol still there, although we dropped our reference');