introduce root set
[scpubgit/DKit.git] / t / ssh_key.t
index 8d8d5c9..da18596 100644 (file)
@@ -1,6 +1,5 @@
 use strictures 1;
 use Test::More;
-use Unknown::Values;
 use List::Util qw(reduce);
 use aliased 'DX::Op::FromCode';
 use DX::Var;
@@ -29,7 +28,7 @@ sub make_set_bind {
     die "key unbound" unless $key->is_bound;
     die "thing bound" if $thing->is_bound;
     if (my $value = $set->{$key->bound_value}) {
-      return $state->bind_var_then($thing, $value, $self->next);
+      return $state->bind_value($thing, $value)->then($self->next);
     }
     return $state->backtrack;
   }
@@ -64,11 +63,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 +90,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);
   };
 }