Don't count PL_sv_{undef,no,yes} in the size returned
[p5sagit/Devel-Size.git] / t / basic.t
index 8073e01..86c58cd 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-use Test::More tests => 15;
+use Test::More tests => 18;
 use strict;
 use Devel::Size qw(size total_size);
 use Scalar::Util qw(weaken);
@@ -100,3 +100,13 @@ cmp_ok (total_size(\&LARGE), '>', 8192,
     is(total_size($a), total_size([]),
        'Any intial reference is dereferenced and discarded');
 }
+
+# Must call direct - avoid all copying:
+foreach(['undef', total_size(undef)],
+       ['no', total_size(1 == 0)],
+       ['yes', total_size(1 == 1)],
+       ) {
+    my ($name, $size) = @$_;
+    is($size, 0,
+       "PL_sv_$name is interpeter wide, so not counted as part of the structure's size");
+}