Commit | Line | Data |
ee7c0467 |
1 | use strict; |
2 | use warnings; |
3 | |
e9a19694 |
4 | use Test::More tests => 6; |
ee7c0467 |
5 | use Test::Exception; |
6 | |
efd3d14c |
7 | use Class::MOP::Instance; |
ee7c0467 |
8 | |
9 | my $C = 'Class::MOP::Instance'; |
10 | |
11 | { |
12 | my $instance = '$self'; |
e9a19694 |
13 | my $slot_name = 'foo'; |
ee7c0467 |
14 | my $value = '$value'; |
15 | |
8d2d4c67 |
16 | is($C->inline_get_slot_value($instance, $slot_name), |
230472a7 |
17 | '$self->{"foo"}', |
ee7c0467 |
18 | '... got the right code for get_slot_value'); |
8d2d4c67 |
19 | |
20 | is($C->inline_set_slot_value($instance, $slot_name, $value), |
ee7c0467 |
21 | '$self->{"foo"} = $value', |
8d2d4c67 |
22 | '... got the right code for set_slot_value'); |
ee7c0467 |
23 | |
8d2d4c67 |
24 | is($C->inline_initialize_slot($instance, $slot_name), |
a007159d |
25 | '', |
ee7c0467 |
26 | '... got the right code for initialize_slot'); |
8d2d4c67 |
27 | |
28 | is($C->inline_is_slot_initialized($instance, $slot_name), |
230472a7 |
29 | 'exists $self->{"foo"}', |
8d2d4c67 |
30 | '... got the right code for get_slot_value'); |
31 | |
32 | is($C->inline_weaken_slot_value($instance, $slot_name), |
ee7c0467 |
33 | 'Scalar::Util::weaken( $self->{"foo"} )', |
8d2d4c67 |
34 | '... got the right code for weaken_slot_value'); |
35 | |
36 | is($C->inline_strengthen_slot_value($instance, $slot_name), |
ee7c0467 |
37 | '$self->{"foo"} = $self->{"foo"}', |
8d2d4c67 |
38 | '... got the right code for strengthen_slot_value'); |
39 | } |
40 | |
8d2d4c67 |
41 | |