more tests

This commit is contained in:
Kyle Maxwell 2008-12-20 16:16:41 -08:00
parent e0e636e05c
commit 4e23ab4bd8
4 changed files with 16 additions and 11 deletions

View File

@ -187,11 +187,8 @@ void __dex_recurse_foreach(struct json_object * json, char* key, struct json_obj
}
break;
case json_type_string:
// printf("str");
break;
case json_type_object:
// printf("obj");
break;
__dex_recurse(val, buf, astrcat3(context, ".", tag));
};
sprintbuf(buf, "</%s>\n", tag);

5
fixtures/obj.dex Normal file
View File

@ -0,0 +1,5 @@
{
"foo": {
"bar": "h1"
}
}

1
fixtures/obj.yelp.json Normal file
View File

@ -0,0 +1 @@
{ "foo": { "bar": "Nick's Crispy Tacos" } }

View File

@ -2,13 +2,15 @@
require "test/unit"
class Tests < Test::Unit::TestCase
def test_simple_array
dex_test "li.dex", "yelp.html", "li.yelp.json"
def self.dex_test(dex, input, output)
define_method "test_#{[dex,input,output].join(' ').gsub(/\W/, '_')}" do
root = File.dirname(__FILE__)
fixtures = "#{root}/fixtures"
assert_equal `./dexter #{fixtures}/#{dex} #{fixtures}/#{input}`, File.read("#{fixtures}/#{output}")
end
end
def dex_test(dex, input, output)
root = File.dirname(__FILE__)
fixtures = "#{root}/fixtures"
assert_equal `./dexter #{fixtures}/#{dex} #{fixtures}/#{input}`, File.read("#{fixtures}/#{output}")
end
dex_test "li.dex", "yelp.html", "li.yelp.json"
dex_test "obj.dex", "yelp.html", "obj.yelp.json"
end