Permalink
Browse files

Adding basic session test (incomplete)

  • Loading branch information...
1 parent 9b5ac81 commit c06731876aae44774e04030a7c7161e26afd92a6 @sanko committed Jun 16, 2011
Showing with 59 additions and 1 deletion.
  1. +2 −1 MANIFEST
  2. +57 −0 t/100_active/101_session.t
View
@@ -8,4 +8,5 @@ MANIFEST This list of files
META.json
META.yml
README
-t/001_basic/001_use_ok.t
+t/000_basic/001_use_ok.t
+t/100_active/101_login.t
View
@@ -0,0 +1,57 @@
+use AnyEvent;
+use Test::More;
+use lib -f 'BUILD' ? 'lib' : '../../lib';
+use_ok 'AnyEvent::MSN';
+$AnyEvent::MSN::DEBUG++;
+
+my $cv = AnyEvent->condvar;
+my $to =
+ AnyEvent->timer(after => 60, cb => sub { diag 'Timeout!'; $cv->send });
+my $msn = AnyEvent::MSN->new(
+ passport => 'anyevent_msn@hotmail.com',
+ password => 'public',
+ on_connect => sub {
+ my $s = shift;
+ pass sprintf 'Connected as %s. Adding self to buddy list...', $s->passport;
+ #$cv->send;
+ $s->add_buddy($s->passport);
+ # $s->remove_buddy($s->passport);
+ },
+ on_error => sub {
+ my (undef, $msg, $fatal) = @_;
+ diag ucfirst sprintf '%serror: %s', ($fatal ? 'fatal ' : ''), $msg;
+ $cv->send;
+ },
+ on_user_notification =>sub {shift; use Data::Dump; ddx \@_; ...}
+);
+$cv->recv;
+done_testing;
+
+=pod
+
+=head1 Author
+
+Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
+
+CPAN ID: SANKO
+
+=head1 License and Legal
+
+Copyright (C) 2011 by Sanko Robinson <sanko@cpan.org>
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of
+L<The Artistic License 2.0|http://www.perlfoundation.org/artistic_license_2_0>.
+See the F<LICENSE> file included with this distribution or
+L<notes on the Artistic License 2.0|http://www.perlfoundation.org/artistic_2_0_notes>
+for clarification.
+
+When separated from the distribution, all original POD documentation is
+covered by the
+L<Creative Commons Attribution-Share Alike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/us/legalcode>.
+See the
+L<clarification of the CCA-SA3.0|http://creativecommons.org/licenses/by-sa/3.0/us/>.
+
+Neither this module nor the L<Author|/Author> is affiliated with Microsoft.
+
+=cut

0 comments on commit c067318

Please sign in to comment.