From be7a05d8ab42000d5597ed3b39d9c69b2df7dba2 Mon Sep 17 00:00:00 2001 From: Kyle Maxwell Date: Thu, 19 Feb 2009 00:28:54 -0800 Subject: [PATCH] fixed string length bug --- ruby/ext/cdexter.c | 2 +- ruby/test/test_dexterous.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ruby/ext/cdexter.c b/ruby/ext/cdexter.c index 099fab2..c1814b4 100644 --- a/ruby/ext/cdexter.c +++ b/ruby/ext/cdexter.c @@ -48,7 +48,7 @@ VALUE _parse_string(VALUE self, VALUE string, VALUE input, VALUE output) { dexPtr dex; Data_Get_Struct(self, dexPtr, dex); char* cstr = STR2CSTR(string); - return _parse_doc(dex_parse_string(dex, cstr, strlen(string), input == ID2SYM(rb_intern("html"))), output); + return _parse_doc(dex_parse_string(dex, cstr, strlen(cstr), input == ID2SYM(rb_intern("html"))), output); } VALUE _parse_doc(parsedDexPtr ptr, VALUE type) { diff --git a/ruby/test/test_dexterous.rb b/ruby/test/test_dexterous.rb index 453fb44..89c9e68 100644 --- a/ruby/test/test_dexterous.rb +++ b/ruby/test/test_dexterous.rb @@ -11,6 +11,11 @@ class TestDexterous < Test::Unit::TestCase assert_equal({"hi" => "Nick's Crispy Tacos"}, @dex.parse(:file => @file)) end + def test_simple_string + @dex = Dexterous.new("hi" => "h1") + assert_equal({"hi" => "Nick's Crispy Tacos"}, @dex.parse(:string => "

Nick's Crispy Tacos

")) + end + def test_xml @dex = Dexterous.new("hi" => "h1") xml = "\nNick's Crispy Tacos\n"