From 308ef39be3704926f5abdf5b3583047441e7e830 Mon Sep 17 00:00:00 2001 From: Kris Jordan Date: Mon, 3 Jan 2011 23:47:46 -0500 Subject: [PATCH] Added fail test for scenario when a rule prerequisite has outputs. The target should be connected to the outputs, not the recipe prerequisite. --- spec/rules.vows.coffee | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/spec/rules.vows.coffee b/spec/rules.vows.coffee index 7a39029..64934a5 100644 --- a/spec/rules.vows.coffee +++ b/spec/rules.vows.coffee @@ -54,7 +54,7 @@ vows topic: (graph) -> graph.nodes.ofType FileNode 'of length 1': (files) -> assert.length files.items, 1 - 'A RuleGraph f([A]) -> B=>c': + 'A RuleGraph f([A]) -> B=>C': topic: -> graph = new RuleGraph graph.rule new Rule 'B', ['A'], new Recipe (->), (->['C']) @@ -80,5 +80,30 @@ vows to = _(arcs.pluck 'to').pluck 'name' ['B','C'].forEach (item) -> assert.includes to, item + 'A RuleGraph f([A])->B=>C, f([B])->D': + topic: -> + graph = new RuleGraph + graph.rule new Rule 'B', ['A'], new Recipe (->), (->['C']) + graph.rule new Rule 'D', ['B'], (->) + 'has RecipeNodes': + topic: (graph) -> graph.nodes.ofType RecipeNode + 'of length 2': (recipes) -> + assert.length recipes.items, 2 + 'has FileNodes': + topic: (graph) -> graph.nodes.ofType FileNode + 'of length 2': (files) -> + assert.length files.items, 2 + 'has Arcs': + topic: (graph) -> graph.arcs + 'of length 3': (arcs) -> + assert.length arcs.items, 3 + 'from A,B,C': (arcs) -> + from = _(arcs.pluck 'from').pluck 'name' + ['A','B','C'].forEach (item) -> + assert.includes from, item + 'to B,C,D': (arcs) -> + to = _(arcs.pluck 'to').pluck 'name' + ['B','C','D'].forEach (item) -> + assert.includes to, item ) .export(module)