more tests
This commit is contained in:
parent
e0e636e05c
commit
4e23ab4bd8
5
dexter.c
5
dexter.c
|
@ -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);
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"foo": {
|
||||
"bar": "h1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{ "foo": { "bar": "Nick's Crispy Tacos" } }
|
16
tests.rb
16
tests.rb
|
@ -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
|
Loading…
Reference in New Issue