ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/06_socket.t
Revision: 1.2
Committed: Thu Jul 17 15:44:19 2008 UTC (15 years, 11 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-4_35, rel-4_231, rel-4_4, rel-4_233, rel-4_45, rel-4_23, rel-4_82, rel-4_41, rel-4_352, rel-4_42, rel-4_234, rel-4_31, rel-4_32, rel-4_34, rel-4_412, rel-4_83, rel-4_232, rel-4_81, rel-4_3, rel-4_22, rel-4_33, rel-4_411, rel-4_351, rel-4_8, rel-4_331
Changes since 1.1: +7 -3 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 $|=1;
2 BEGIN { print "1..19\n" }
3
4 no warnings; # nazis
5
6 use AnyEvent::Socket;
7
8 print "ok 1\n";
9
10 sub ph {
11 my ($id, $str, $dport, $host, $port) = @_;
12
13 $str =~ s/_/ /g unless ref $str;
14
15 my ($h, $p) = parse_hostport ref $str ? $$str : $str, $dport;
16
17 print $h eq $host && $p eq $port ? "" : "not ", "ok $id # '$str,$dport' => '$h,$p' eq '$host,$port'\n";
18 }
19
20 ph 2, "";
21 ph 3, "localhost";
22 ph 4, qw(localhost 443 localhost 443);
23 ph 5, qw(localhost:444 443 localhost 444);
24 ph 6, qw(10.0.0.1 443 10.0.0.1 443);
25 ph 7, qw(10.1:80 443 10.1 80);
26 ph 8, qw(::1 443 ::1 443);
27 ph 9, qw(::1:80 443 ::1:80 443);
28 ph 10, qw([::1]:80 443 ::1 80);
29 ph 11, qw([::1]_80 443 ::1 80);
30 ph 12, qw([::1]_: 443);
31 ph 13, qw([::1]: 443);
32 ph 14, qw(::1_smtp 443 ::1 smtp);
33 ph 15, qw([www.linux.org]_80 443 www.linux.org 80);
34 ph 16, qw([10.1]:80 443 10.1 80);
35 ph 17, qw(10.1_80 443 10.1 80);
36
37 my $var = "2002:58c6:438b::10.0.0.17";
38 ph 18, \$var, qw(443 2002:58c6:438b::10.0.0.17 443);
39 ph 19, \$var, qw(443 2002:58c6:438b::10.0.0.17 443);
40