23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ritsu/test_helpers.rb', line 23
def file_test(name, &block)
case_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
if !Ritsu::Utility::Strings::is_c_name?(case_name.to_s)
raise "'#{name}' does not yield a valid test case name (i.e., a C name)"
end
defined = instance_method(case_name) rescue false
raise "#{case_name} is already defined in #{self}" if defined
if block_given?
define_method(case_name) do
init_data_dir
instance_eval(&block)
end
else
define_method(case_name) do
flunk "No implmentation provided for #{case_name}"
end
end
end
|