forked from duckduckgo/zeroclickinfo-goodies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUID.t
44 lines (37 loc) · 1.24 KB
/
GUID.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Deep;
use DDG::Test::Goodie;
zci answer_type => 'guid';
zci is_cached => 0;
sub build_structured_answer {
return re(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}$/),
structured_answer => {
data => {
title => re(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}$/),
subtitle => 'Random GUID',
},
templates => {
group => 'text',
},
},
}
sub build_test {
return test_zci(build_structured_answer());
}
ddg_goodie_test([qw( DDG::Goodie::GUID ) ],
# Check that the trigger kicks in.
'guid' => build_test(),
'uuid' => build_test(),
'globally unique identifier' => build_test(),
'rfc 4122' => build_test(),
'new guid' => build_test(),
'random uuid' => build_test(),
'generate new uuid' => build_test(),
'generate random uuid' => build_test(),
'uuid in ansi C' => undef,
'what is a guid' => undef,
);
done_testing;