summaryrefslogtreecommitdiff
path: root/bin/run_tests
diff options
context:
space:
mode:
authorkwadronaut <kwadronaut@leap.se>2014-03-26 09:38:41 +0100
committerkwadronaut <kwadronaut@leap.se>2014-03-26 09:38:41 +0100
commite7332f2370db83523c52ca2cf5510db001469093 (patch)
tree23d2c69e355042f1f067cca7a9329733c895c12f /bin/run_tests
parentb45d265a08884a65e7100e34067a0d8c390da8f0 (diff)
parentcd09ed9eb9d183123652a52651a427bab558c496 (diff)
Merge branch 'feature/cleanup-test-names' of https://github.com/elijh/leap_platform into elijh-feature/cleanup-test-names
Diffstat (limited to 'bin/run_tests')
-rwxr-xr-xbin/run_tests15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/run_tests b/bin/run_tests
index 2336eba8..f4fb0157 100755
--- a/bin/run_tests
+++ b/bin/run_tests
@@ -394,11 +394,9 @@ class LeapRunner < MiniTest::Unit
# Converts snake_case and CamelCase to something more pleasant for humans to read.
#
def readable(str)
- str.gsub(/([A-Z]+)([A-Z][a-z])/, '\1 \2').
- gsub(/([a-z])([A-Z])/, '\1 \2').
+ str.
gsub(/_/, ' ').
- sub(/^test (\d* )?/i, '').
- downcase.capitalize
+ sub(/^test (\d* )?/i, '')
end
def machine_readable(str)
@@ -428,7 +426,12 @@ class TestDependencyGraph
end
def tsort_each_child(test_class_name, &block)
- @dependencies[test_class_name].each(&block)
+ if @dependencies[test_class_name]
+ @dependencies[test_class_name].each(&block)
+ else
+ puts "ERROR: bad dependency, no such class `#{test_class_name}`"
+ exit(1)
+ end
end
def sorted
@@ -476,7 +479,7 @@ def pin_test_name(name)
die name, "there is no test class `#{test_class}`"
end
if test_name
- $pinned_test_method = $pinned_test_class.tests.detect{|m| m.to_s =~ /^test_(\d+_)?#{test_name}$/}
+ $pinned_test_method = $pinned_test_class.tests.detect{|m| m.to_s =~ /^test_(\d+_)?#{Regexp.escape(test_name)}$/}
unless $pinned_test_method
die name, "there is no test `#{test_name}` in class `#{test_class}`"
end