0
@@ -9,31 +9,33 @@ H_FILES.map! {|name| name.index('.') ? name : name+".xml"}
0
H_TESTS = H_FILES.map {|arg| Dir[File.join('test/data/filter',arg)]}
0
# test cases are in Python syntax, convert to something that eval will accept
0
-def python2ruby(expr, source)
0
- expr.gsub! " u'", " '"
0
- expr.gsub! ' u"', ' "'
0
+class TestCaseConverter
0
+ def self.python2ruby(expr, source)
0
+ expr.gsub! " u'", " '"
0
+ expr.gsub! ' u"', ' "'
0
- expr.gsub! /"""(.*?)"""/, '%q{\1}'
0
+ expr.gsub! /"""(.*?)"""/, '%q{\1}'
0
- expr.gsub! "': '", "' => '"
0
+ expr.gsub! "': '", "' => '"
0
- expr.gsub! "Items[", "items["
0
- expr.gsub! "Channels[", "channels["
0
+ expr.gsub! "Items[", "items["
0
+ expr.gsub! "Channels[", "channels["
0
- expr = "true" if expr == "1"
0
+ expr = "true" if expr == "1"
0
- # differences in XML/URI serializations
0
- name = source.split('/').last.split('.').first
0
- expr.sub!('"','%22') if name == 'missing_quote_in_attr'
0
- expr.sub! '>', '>' if name == 'tag_in_attr'
0
- expr.gsub!('"', "\\\\'").gsub!('"','"') if name == 'quote_in_attr'
0
+ # differences in XML/URI serializations
0
+ name = source.split('/').last.split('.').first
0
+ expr.sub!('"','%22') if name == 'missing_quote_in_attr'
0
+ expr.sub! '>', '>' if name == 'tag_in_attr'
0
+ expr.gsub!('"', "\\\\'").gsub!('"','"') if name == 'quote_in_attr'
0
require 'planet/formatter'
0
@@ -59,7 +61,7 @@ class HamlTestCase < Test::Unit::TestCase
0
when /Description:\s*(.*?)\s*Expect:\s*(.*)\s*/
0
- desc =
python2ruby($2, file)
0
+ desc =
TestCaseConverter.python2ruby($2, file)
0
doc = Planet.harvest(file)
0
output = HamlFormatter.new.haml_info(doc)
0
channels = output['channels']
0
@@ -67,7 +69,7 @@ class HamlTestCase < Test::Unit::TestCase
0
# for .ini files... any xml will do
0
when /Description:\s*(.*?)\s*; Expect:\s*(.*)\s*/
0
- desc =
python2ruby($2, file)
0
+ desc =
TestCaseConverter.python2ruby($2, file)
0
Planet.config.read file
0
doc = Planet.harvest('test/data/filter/haml/new_channel.xml')
0
output = HamlFormatter.new.haml_info(doc)
Comments
No one has commented yet.