dependency map up, some code running
[scpubgit/DX.git] / t / depmap.t
diff --git a/t/depmap.t b/t/depmap.t
new file mode 100644 (file)
index 0000000..bc4b99c
--- /dev/null
@@ -0,0 +1,29 @@
+use strictures 2;
+use DX::Utils qw(:all);
+use DX::DependencyMap;
+use List::Util qw(reduce);
+use Test::More;
+
+my $start = DX::DependencyMap->new(deps => {}, revdeps => {});
+
+{
+
+  my @xyz = qw(x x.y x.z);
+
+  my $content = reduce {
+    $a->with_entry_for($b, [ [ CONTENTS_OF ,=> split(/\./,$b) ] ])
+  } $start, @xyz;
+
+  is(
+    (join ' ', sort $content->_dependents_of([ VALUE_SET ,=> qw(x y) ])),
+   'x x.y',
+   'x.y set clears contents_of x',
+  );
+  is(
+    (join ' ', sort $content->_dependents_of([ VALUE_SET ,=> qw(x) ])),
+    'x x.y x.z',
+    'x set clears contents_of all x.*',
+  );
+}
+
+done_testing;