stop using return_stack directly in tests
[scpubgit/DKit.git] / t / ssh_key.t
index 8d8d5c9..b7ed6ed 100644 (file)
@@ -64,11 +64,9 @@ sub make_exists {
       code => sub { $_[1]->but(scope => $scope, next_op => $_[0]->next) },
       next => $self->next,
     );
-    $state->but(
-      scope => { %$scope },
-      return_stack => [ @{$state->return_stack}, $ret_op ],
-      next_op => $inner_op
-    )->assign_vars(%vars);
+    $state->but(scope => { %$scope })
+          ->push_return_then($ret_op, $inner_op)
+          ->assign_vars(%vars);
   };
 }
 
@@ -93,14 +91,12 @@ sub make_call {
         die "WTH";
       }
     } @arg_spec;
-    $state->but(
-      scope => {},
-      return_stack => [ @{$state->return_stack}, $ret_op ],
-      next_op => FromCode->new(
-        code => sub { $option->(@_, @args) },
-        next => $pop_ret,
-      ),
+    my $next_op = FromCode->new(
+      code => sub { $option->(@_, @args) },
+      next => $pop_ret,
     );
+    $state->but(scope => {})
+          ->push_return_then($ret_op, $next_op);
   };
 }