Permalink
Browse files

RT#83765: applied patch for new add_dic() method

  • Loading branch information...
1 parent c73345e commit a3a8f816f5d3a85063169b4dc123b1720ee1073a @cosimo committed Mar 9, 2013
Showing with 46 additions and 0 deletions.
  1. +6 −0 Changes
  2. +9 −0 Hunspell.xs
  3. +29 −0 t/07-add-dictionary.t
  4. +2 −0 t/supp.dic
View
@@ -1,5 +1,11 @@
Revision history for Perl extension Text::Hunspell.
+2.06 2013/03/09 11:39:28 Europe/Oslo (cosimo)
+
+ Implemented new add_dic() function from hunspell API.
+ Fixes RT#83765. Thanks to Paul Flo Williams for patch
+ and test case.
+
2.05 2012/09/21 08:17:00 (cosimo)
Fixed RT#79630 incorrect encoding of Hunspell.pm POD documentation.
View
@@ -69,6 +69,15 @@ Hunspell::delete(h)
/* And return something to the caller too. */
RETVAL = 1;
+int
+Hunspell::add_dic(dic)
+ char *dic;
+ CODE:
+ handle = get_hunspell_handle();
+ RETVAL = handle->add_dic(dic);
+
+ OUTPUT:
+ RETVAL
int
Hunspell::check(buf)
View
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+
+use Data::Dumper;
+use Test::More tests => 5;
+use Text::Hunspell;
+
+my $speller = Text::Hunspell->new(qw(./t/test.aff ./t/test.dic));
+die unless $speller;
+ok($speller, qq(Created a Text::Hunspell object [$speller]));
+
+my $word = q(munkey);
+ok(
+ !$speller->check($word),
+ qq(Word '$word' shouldn't be in the test dictionary)
+);
+
+ok(
+ !$speller->add_dic(q(./t/supp.dic)),
+ q(Added a supplemental dictionary)
+);
+
+ok(
+ $speller->check($word),
+ qq(Word '$word' is in the supplemental dictionary)
+);
+
+# Curtains down
+ok($speller->delete($speller), q(delete method presumably worked));
View
@@ -0,0 +1,2 @@
+1
+munkey

0 comments on commit a3a8f81

Please sign in to comment.