zeroclickinfo-goodies/t/GUID.t

44 lines
1.3 KiB
Perl
Raw Normal View History

2013-07-24 12:06:17 -07:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => 'guid';
zci is_cached => 0;
2014-01-21 16:37:13 -08:00
my $heading = 'Random GUID';
2013-07-24 12:06:17 -07:00
ddg_goodie_test(
2014-01-21 16:37:13 -08:00
[qw(
DDG::Goodie::GUID
)],
# Check that the trigger kicks in.
'guid' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/,
html => qr/./,
heading => $heading
),
'uuid' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/,
html => qr/./,
heading => $heading
),
'globally unique identifier' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/,
html => qr/./,
heading => $heading
),
'rfc 4122' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/,
html => qr/./,
heading => $heading
),
# Check the HTML. Just once.
'guid' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/,
2014-01-22 08:36:46 -08:00
html => qr/^<input type="text" onclick='this.select\(\);' size="45" value="([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}"\/>$/,
2014-01-21 16:37:13 -08:00
heading => $heading
),
2013-07-24 12:06:17 -07:00
);
done_testing;