test/test_parsley.rb in fizx-parsley-ruby-0.3.1 vs test/test_parsley.rb in fizx-parsley-ruby-0.3.2

- old
+ new

@@ -12,10 +12,24 @@ @parsley = Parsley.new(File.read(@let)) out = @parsley.parse(:file => @home) assert_equal "/c/sf/shopping", out["categories"][0]["href"] end + def test_parsley_should_raise_if_value_syntax_error + assert_raises(ParsleyError) do + Parsley.new({"foo" => nil}) + end + + assert_raises(ParsleyError) do + Parsley.new({"foo" => ""}) + end + + assert_raises(ParsleyError) do + Parsley.new({"foo" => "<<<<<<<<<<<"}) + end + end + def test_yelp_xml @parsley = Parsley.new(File.read(@let)) out = @parsley.parse(:file => @home, :output => :xml) end @@ -36,10 +50,10 @@ assert_equal({"hi" => "Nick's Crispy Tacos"}, @parsley.parse(:string => "<html><body><h1>Nick's Crispy Tacos</h1></body></html>")) end def test_xml @parsley = Parsley.new("hi" => "h1") - xml = "<?xml version=\"1.0\"?>\n<parsley:root xmlns:parsley=\"http://parselets.com/json\"><hi position=\"63\">Nick's Crispy Tacos</hi></parsley:root>\n" + xml = "<?xml version=\"1.0\"?>\n<parsley:root xmlns:parsley=\"http://parselets.com/json\"><hi position=\"105\">Nick's Crispy Tacos</hi></parsley:root>\n" assert_equal(xml, @parsley.parse(:file => @page, :output => :xml)) end def test_json @parsley = Parsley.new("hi" => "h1") \ No newline at end of file