languages.t 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the
  15. # Free Software Foundation, Inc.
  16. # 59 Temple Place, Suite 330
  17. # Boston, MA 02111-1307 USA
  18. require 't/test.pl';
  19. package OddMuse;
  20. use Test::More tests => 5;
  21. use utf8; # tests contain UTF-8 characters and it matters
  22. %Languages = ('de' => '\b(der|die|das|und|oder)\b',
  23. 'fr' => '\b(et|le|la|pas)\b', );
  24. is(GetLanguages('This is English text and cannot be identified.'), '', 'unknown language');
  25. is(GetLanguages('Die Katze tritt die Treppe krumm.'), '', 'not enough German words');
  26. is(GetLanguages('Die Katze tritt die Treppe und die Stiege krumm.'), 'de', 'enough German words');
  27. is(GetLanguages('Le chat fait la même chose et ne chante pas.'), 'fr', 'enough French words');
  28. is(GetLanguages('Die Katze tritt die Treppe und die Stiege krumm. '
  29. . 'Le chat fait la même chose et ne chante pas.'), 'de,fr', 'both German and French');