Remove Moose::Meta::Object::Trait
[gitmo/Moose.git] / t / cmop / instance_inline.t
CommitLineData
38bf2a25 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Fatal;
6
24aaf639 7use Class::MOP;
38bf2a25 8use Class::MOP::Instance;
9
10my $C = 'Class::MOP::Instance';
11
12{
13 my $instance = '$self';
14 my $slot_name = 'foo';
15 my $value = '$value';
16 my $class = '$class';
17
18 is($C->inline_create_instance($class),
19 'bless {} => $class',
20 '... got the right code for create_instance');
21 is($C->inline_get_slot_value($instance, $slot_name),
22 q[$self->{"foo"}],
23 '... got the right code for get_slot_value');
24
25 is($C->inline_set_slot_value($instance, $slot_name, $value),
26 q[$self->{"foo"} = $value],
27 '... got the right code for set_slot_value');
28
29 is($C->inline_initialize_slot($instance, $slot_name),
30 '',
31 '... got the right code for initialize_slot');
32
33 is($C->inline_is_slot_initialized($instance, $slot_name),
34 q[exists $self->{"foo"}],
35 '... got the right code for get_slot_value');
36
37 is($C->inline_weaken_slot_value($instance, $slot_name),
38 q[Scalar::Util::weaken( $self->{"foo"} )],
39 '... got the right code for weaken_slot_value');
40
41 is($C->inline_strengthen_slot_value($instance, $slot_name),
42 q[$self->{"foo"} = $self->{"foo"}],
43 '... got the right code for strengthen_slot_value');
44 is($C->inline_rebless_instance_structure($instance, $class),
45 q[bless $self => $class],
46 '... got the right code for rebless_instance_structure');
47}
48
49done_testing;