lib/tartan/test/wiki-test.rb in tartan-0.2.0 vs lib/tartan/test/wiki-test.rb in tartan-0.2.1
- old
+ new
@@ -1,6 +1,6 @@
-#$Id: wiki-test.rb 193 2007-04-18 15:27:15Z alpinegizmo $
+#$Id: wiki-test.rb 207 2007-06-04 15:45:31Z bitherder $
require 'test/unit'
require 'yaml'
require 'benchmark'
require 'core_ext/file'
@@ -14,12 +14,10 @@
# if either the testfile or target argument is a single value, turn
# it into a single element array
testfiles = testfiles.to_a
- targests = targets.to_a
-
Class.new Test::Unit::TestCase do
define_method 'parserClass' do
parserKlass
end
@@ -79,18 +77,19 @@
next unless doc['in']
title = doc['title'] ? doc['title'] : (sequence += 1).to_s
targets.each do |target|
- target = target.to_sym if target.is_a? String
- target_name = target.id2name if target.is_a? Symbol
+ if target.kind_of? Array
+ target = target.find {|t| doc[t.to_s]}
+ end
- next unless doc[target_name]
+ next unless doc[target.to_s]
- define_method "test_#{target_name}_" + title do
- test_parser doc, options.dup, target, target_name
+ define_method "test_#{target.to_s}_" + title do
+ test_parser doc, options.dup, target.to_sym, target.to_s
end # define_method
- end # targests.each
+ end # targets.each
end # YAML::load_documents
end # testfiles.each
end # Class.new
end # intialize
end # class WikiTestCases