]> err.no Git - libchamplain/commitdiff
Scalar context on a XS method is too strange
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Thu, 9 Jul 2009 20:22:13 +0000 (22:22 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 28 Jul 2009 21:25:42 +0000 (17:25 -0400)
bindings/perl/Champlain/t/ChamplainSelectionLayer.t
bindings/perl/Champlain/xs/ChamplainSelectionLayer.xs

index e4944da0635a8b17613545025bc1c411859b1b33..c042bd6961478a1111549a8bd8d22754733e0027 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Clutter::TestHelper tests => 25;
+use Clutter::TestHelper tests => 24;
 
 use Champlain;
 use Data::Dumper;
@@ -23,18 +23,16 @@ sub test_empty {
        my $layer = Champlain::SelectionLayer->new();
        isa_ok($layer, 'Champlain::Layer');
 
-       my $count;
-       my @markers;
-
        is($layer->get_selected, undef, "[empty] get_selected()");
 
        # In single mode get_selected_markers doesn't work
-       @markers = $layer->get_selected_markers;
-       is_deeply(\@markers, [], "[empty] get_selected_markers() list context");
-       $count = $layer->get_selected_markers;
-       is($count, 0, "[empty] get_selected_markers() scalar context");
+       is_deeply(
+               [$layer->get_selected_markers],
+               [], 
+               "[empty] get_selected_markers()"
+       );
 
-       $count = $layer->count_selected_markers;
+       my $count = $layer->count_selected_markers;
        is($count, 0, "[empty] count_selected_markers()");
 
        my $marker = Champlain::BaseMarker->new();
index e36fb313f9dfe1c94e5ed77e0eb9929fe290b418..72d4f293c3b59cc629707a83378365ca7e088882 100644 (file)
@@ -20,12 +20,7 @@ champlain_selection_layer_get_selected_markers (ChamplainSelectionLayer *layer)
        
        PPCODE:
                item = champlain_selection_layer_get_selected_markers(layer);
-
                if (!item) {
-                       if (GIMME == G_SCALAR) {
-                               XPUSHs(sv_2mortal(newSViv(0)));
-                               return;
-                       }
                        XSRETURN_EMPTY;
                }