new Op::Predicate
[scpubgit/DKit.git] / t / dot_ssh.t
index 2e37b31..f4cb2de 100644 (file)
@@ -274,25 +274,14 @@ is($path_status{'.ssh'}, $protos{'.ssh'}, 'Created observed');
 
 ok(!$res[0]->actions, 'No action');
 
+$solver->add_predicate(
+  catfile => [ qw(DirPath FileName FilePath) ],
+    [ qw(+ + -) ] => sub {
+      +(FilePath => [ value => File::Spec->catfile($_{DirPath}, $_{FileName}) ])
+    },
+);
+
 $solver->add_rule(@$_) for (
-  [ catfile => [ qw(DirPath FileName FilePath) ],
-    DX::Op::FromCode->new(code => sub {
-      my ($self, $state) = @_;
-      my ($dir_path, $file_name, $file_path)
-        = map $state->scope_var($_), qw(DirPath FileName FilePath);
-      die "No." unless $dir_path->is_bound;
-      die "No." unless $file_name->is_bound;
-      die "No." if $file_path->is_bound;
-      my $cat_file = File::Spec->catfile(
-        map $_->bound_value, $dir_path, $file_name
-      );
-      $state->bind_value($file_path->id, $cat_file)
-            ->add_dependencies(
-                $file_path->id => $dir_path->id,
-                $file_path->id => $file_name->id,
-              )
-            ->then($self->next);
-    }) ],
   [ file_in => [ qw(DirStatus FileName FileStatus) ],
     [ is_directory => qw(DirStatus) ],
     [ exists => [ qw(DirPath) ],