summaryrefslogtreecommitdiff
path: root/tests/modules/graph
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/graph')
-rw-r--r--tests/modules/graph/test.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/modules/graph/test.lua b/tests/modules/graph/test.lua
index 1fb0bcb43..c242962db 100644
--- a/tests/modules/graph/test.lua
+++ b/tests/modules/graph/test.lua
@@ -46,12 +46,14 @@ function test_paritail_topo_sort(t)
local order_vertices = {}
while true do
node, has_cycle = dag:partial_topo_sort_next()
- if node == nil or has_cycle then
- break
- end
- table.insert(order_vertices, node)
if node then
+ table.insert(order_vertices, node)
dag:partial_topo_sort_remove(node)
+ else
+ if has_cycle then
+ raise("has cycle!")
+ end
+ break
end
end