2013-06-21 13:35:10 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
2013-06-21 14:04:04 -07:00
|
|
|
use DDG::Test::Location;
|
|
|
|
use DDG::Request;
|
2013-06-21 13:35:10 -07:00
|
|
|
|
|
|
|
zci answer_type => 'helpline';
|
|
|
|
|
2013-06-21 14:04:04 -07:00
|
|
|
my @queries = (
|
2013-06-24 11:33:56 -07:00
|
|
|
'suicide',
|
2014-01-23 21:21:43 -08:00
|
|
|
'suicide hotline',
|
|
|
|
'kill myself',
|
2013-06-24 11:33:56 -07:00
|
|
|
'suicidal thoughts',
|
2014-01-23 21:21:43 -08:00
|
|
|
'end my life',
|
|
|
|
'suicidal thoughts',
|
|
|
|
'suicidal',
|
|
|
|
'suicidal ideation',
|
|
|
|
'i want to kill myself',
|
|
|
|
'commit suicide',
|
|
|
|
'suicide pills',
|
|
|
|
'suicide pill',
|
|
|
|
'suicide prevention',
|
|
|
|
'kill myself',
|
2013-06-21 14:04:04 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
my @locations = (
|
2014-01-23 21:21:43 -08:00
|
|
|
'au',
|
2013-06-21 14:04:04 -07:00
|
|
|
'us',
|
2014-01-23 21:21:43 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
my @ok_queries = (
|
|
|
|
'suicide girls',
|
|
|
|
'suicide silence',
|
2013-06-21 14:04:04 -07:00
|
|
|
);
|
|
|
|
|
2013-06-21 13:35:10 -07:00
|
|
|
ddg_goodie_test(
|
|
|
|
[qw(
|
|
|
|
DDG::Goodie::HelpLine
|
|
|
|
)],
|
2013-06-24 11:33:56 -07:00
|
|
|
(map {
|
|
|
|
my $query = $queries[$_];
|
|
|
|
map {
|
|
|
|
DDG::Request->new(
|
|
|
|
query_raw => "$query",
|
|
|
|
location => test_location("$locations[$_]")
|
|
|
|
),
|
2014-01-29 12:27:28 -08:00
|
|
|
test_zci(qr/24 Hour Suicide Hotline/),
|
2013-06-24 11:33:56 -07:00
|
|
|
} 0 .. scalar @locations - 1
|
|
|
|
} 0 .. scalar @queries - 1),
|
|
|
|
(map {
|
2014-01-23 21:21:43 -08:00
|
|
|
my $query = $ok_queries[$_];
|
2013-06-24 11:33:56 -07:00
|
|
|
map {
|
|
|
|
DDG::Request->new(
|
|
|
|
query_raw => "$query",
|
|
|
|
location => test_location("$locations[$_]")
|
|
|
|
),
|
|
|
|
undef
|
|
|
|
} 0 .. scalar @locations - 1
|
2014-01-23 21:21:43 -08:00
|
|
|
} 0 .. scalar @ok_queries - 1),
|
2013-06-21 13:35:10 -07:00
|
|
|
);
|
|
|
|
|
2013-06-24 11:33:56 -07:00
|
|
|
done_testing(
|
|
|
|
(scalar @queries * scalar @locations * 2) +
|
2014-01-23 21:21:43 -08:00
|
|
|
(scalar @ok_queries * scalar @locations)
|
2013-06-24 11:33:56 -07:00
|
|
|
);
|