First test

master
antoine 2013-09-05 15:42:42 +02:00
parent ca0557e108
commit fa343f0b2f
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package DDG::Goodie::LeetSpeak;
# ABSTRACT: Translate the query into leet speak.
use DDG::Goodie;
triggers startend => 'leetspeak', 'l33tsp34k', 'l33t', 'leet speak', 'l33t sp34k';
primary_example_queries 'leetspeak hello world !';
description 'translates into leetspeak';
topics 'geek';
category 'conversions';
name 'LeetSpeak';
handle remainder => sub {
if(not $_) { return; };
my @alphabet = (
'/-\\','|3','(','|)','3','|=','6','|-|','1','_|','|<','|_','|\/|','|\|','0','|D','(,)','|2','5',"']['",'|_|','\/','\^/','><',"`/",'2'
);
my $res = "";
my $A = ord 'A';
my $Z = ord 'Z';
foreach my $letter (split //, uc $_)
{
my $l = ord $letter;
if ($l <= $Z and $l >= $A) { $res .= $alphabet[$l - $A]; }
else { $res .= $letter; }
}
return 'Leet Speak: ' . $res;
};
zci is_cached => 0;
1;

27
log.txt Normal file
View File

@ -0,0 +1,27 @@
Found a dist.ini, suggesting a Dist::Zilla distribution
--> Working on Dist::Zilla::Plugin::Git::NextVersion
Fetching http://www.cpan.org/authors/id/C/CJ/CJM/Dist-Zilla-Plugin-Git-2.014.tar.gz ... OK
Configuring Dist-Zilla-Plugin-Git-2.014 ... OK
==> Found dependencies: MooseX::AttributeShortcuts
--> Working on MooseX::AttributeShortcuts
Fetching http://www.cpan.org/authors/id/R/RS/RSRCHBOY/MooseX-AttributeShortcuts-0.020.tar.gz ... OK
Configuring MooseX-AttributeShortcuts-0.020 ... OK
==> Found dependencies: MooseX::CoercePerAttribute
--> Working on MooseX::CoercePerAttribute
Fetching http://www.cpan.org/authors/id/M/MR/MRF/MooseX-CoercePerAttribute-1.000.tar.gz ... OK
Configuring MooseX-CoercePerAttribute-1.000 ... OK
Building and testing MooseX-CoercePerAttribute-1.000 ... FAIL
--> Working on Dist::Zilla::Plugin::GithubMeta
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Dist-Zilla-Plugin-GithubMeta-0.34.tar.gz ... FAIL
[ERROR] Failure on installation of modules!
This could have several reasons, for first you can just restart this installer,
cause it could be a pure download problem. If this isnt the case, please read
the build.log mentioned on the errors and see if you can fix the problem
yourself. Otherwise, please report the problem via email to use at
open@duckduckgo.com with the build.log attached. If there is no build.log
mentioned, just attach the output you see.

24
t/LeetSpeak.t Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => 'leetspeak';
zci is_cached => 0;
ddg_goodie_test(
[ 'DDG::Goodie::LeetSpeak'],
'leetspeak hello world !' => test_zci('Leet Speak: |-|3|_|_0 \^/0|2|_|) !'),
'l33tsp34k hElLo WORlD !' => test_zci('Leet Speak: |-|3|_|_0 \^/0|2|_|) !'),
'what is l33t' => test_zci("Leet Speak: \\^/|-|/-\\'][' 15"),
'leet speak leetspeak' => test_zci("Leet Speak: |_33']['5|D3/-\\|<"),
'l33t sp34k /!§ ;€' => test_zci("Leet Speak: /!§ ;€"),
);
done_testing;