]> git.vpit.fr Git - perl/modules/Sub-Nary.git/commitdiff
scale() shouldn't fill {}
authorVincent Pit <vince@profvince.com>
Thu, 21 Aug 2008 10:52:25 +0000 (12:52 +0200)
committerVincent Pit <vince@profvince.com>
Sun, 30 Nov 2008 00:00:55 +0000 (01:00 +0100)
Nary.xs
t/15-misc-xs.t

diff --git a/Nary.xs b/Nary.xs
index 285bfc39973766318639023337c2f0916e90fb0f..dc8e0890d3857907888a24b10925fad9ffe9138f 100644 (file)
--- a/Nary.xs
+++ b/Nary.xs
@@ -140,7 +140,7 @@ CODE:
  } else {
   hv = (HV *) SvRV(sv);
   if (!hv_iterinit(hv)) {
-   sn_store(res, "0", 1, newSVnv(c), 0);
+   XSRETURN_UNDEF;
   } else {
    hv_iterinit(hv);
    while (key = hv_iternext(hv)) {
index c9ac01dedd22c2ffd13620aec8fad8cdd6d3c8dd..7cc94042aea4da6ecb7147c10ea12504bf970f63 100644 (file)
@@ -23,8 +23,8 @@ is_deeply(normalize({ list => 1, 2 => 2, 3 => 1 }),
 
 *scale = *Sub::Nary::scale{CODE};
 
-is_deeply(scale(1,   {}),            { 0 => 1 },    'scale 1, empty-ref');
-is_deeply(scale(0.5, {}),            { 0 => 0.5 },  'scale 0.5, empty-ref');
+is_deeply(scale(1,   {}),            undef,         'scale 1, empty-ref');
+is_deeply(scale(0.5, {}),            undef,         'scale 0.5, empty-ref');
 is_deeply(scale(0.5, { list => 2 }), { list => 1 }, 'scale 0.5, list');
 is_deeply(scale(0.5, { list => 2, 1 => 2 }), { list => 1, 1 => 1 },
                      'scale 0.5, list/const');