Top Level Namespace

Defined Under Namespace

Modules: TestML

Instance Method Summary collapse

Instance Method Details

#_get_test_nameObject

Find the first call stack entry that looks like: …/test/xxx-yyy.rb and return ‘test_xxx_yyy’ as the test name.



210
211
212
213
214
215
216
# File 'lib/testml/lite.rb', line 210

def _get_test_name
  name = caller.map { |s|
    s.split(':').first
  }.grep(/(^|\/)test\/[-\w]+\.rb$/).first or fail
  name.gsub!(/^(?:.*\/)?test\/([-\w+]+)\.rb$/, '\1').gsub(/[^\w]+/, '_')
  return "test_#{name}"
end