about summary refs log tree commit diff stats
path: root/020run.cc
diff options
context:
space:
mode:
Diffstat (limited to '020run.cc')
-rw-r--r--020run.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/020run.cc b/020run.cc
index f3891cf6..3f68cb9c 100644
--- a/020run.cc
+++ b/020run.cc
@@ -329,7 +329,12 @@ void run(string form) {
   transform_all();
   if (tmp.empty()) return;
   if (trace_count("error") > 0) return;
-  run(tmp.front());
+  // if a test defines main, it probably wants to start there regardless of
+  // definition order
+  if (contains_key(Recipe, get(Recipe_ordinal, "main")))
+    run(get(Recipe_ordinal, "main"));
+  else
+    run(tmp.front());
 }
 
 :(scenario run_label)