diff plugins/perl/scripts/account.pl @ 12364:6fd82071a7b8

[gaim-migrate @ 14668] sf patch #1373688, from Will Thompson "Make the Perl bindings more Perl-ish" committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 05 Dec 2005 23:54:34 +0000
parents 4d9686e7c234
children
line wrap: on
line diff
--- a/plugins/perl/scripts/account.pl	Mon Dec 05 23:41:29 2005 +0000
+++ b/plugins/perl/scripts/account.pl	Mon Dec 05 23:54:34 2005 +0000
@@ -8,7 +8,12 @@
 	name => " Perl: $MODULE_NAME", 
 	version => "0.1", 
 	summary => "Test plugin for the Perl interpreter.", 
-	description => "Implements a set of test proccedures to ensure all functions that work in the C API still work in the Perl plugin interface.  As XSUBs are added, this *should* be updated to test the changes.  Furthermore, this will function as the tutorial perl plugin.", 
+	description => "Implements a set of test proccedures to ensure all " .
+	               "functions that work in the C API still work in the " .
+		       "Perl plugin interface.  As XSUBs are added, this " .
+		       "*should* be updated to test the changes.  " .
+		       "Furthermore, this will function as the tutorial perl " .
+		       "plugin.",
 	author => "John H. Kelm <johnhkelm\@gmail.com>", 
 	url => "http://sourceforge.net/users/johnhkelm/", 
 	
@@ -48,9 +53,9 @@
 	#				#
 	#################################
 
-	print "Testing: Gaim::Account::Option::new...\n";
-	$account_opt = Gaim::Account::Option::new(1, "TEXT", "pref_name"); 
-	Gaim::Account::Option::bool_new("TeXt", "MYprefName", 1);
+	print "Testing: Gaim::Account::Option::new()...\n";
+	$acc_opt  = Gaim::Account::Option->new(1, "TEXT", "pref_name");
+	$acc_opt2 = Gaim::Account::Option->bool_new("TeXt", "MYprefName", 1);
 	
 	#################################
 	#				#
@@ -59,37 +64,45 @@
 	#################################
 
 
-	print "Testing: Gaim::Account::new()...";
-	$account = Gaim::Account::new($TEST_NAME, $PROTOCOL_ID);
+	print "Testing: Gaim::Account::new()... ";
+	$account = Gaim::Account->new($TEST_NAME, $PROTOCOL_ID);
 	if ($account) { print "ok.\n"; } else { print "fail.\n"; }
 
-	print "Testing: Gaim::Account::add()...";
+	print "Testing: Gaim::Accounts::add()...";
 	Gaim::Accounts::add($account);
-		print "pending find...\n"; 
+	print "pending find...\n";
 
 	print "Testing: Gaim::Accounts::find()...";
 	$account = Gaim::Accounts::find($TEST_NAME, $PROTOCOL_ID);
 	if ($account) { print "ok.\n"; } else { print "fail.\n"; }
 	
-	print "Testing: Gaim::Account::get_username()...";
-	$user_name = Gaim::Account::get_username($account);
-	if ($user_name) { print $user_name . "...ok.\n"; } else { print "fail.\n"; }
-
+	print "Testing: Gaim::Account::get_username()... ";
+	$user_name = $account->get_username();
+	if ($user_name) {
+		print "Success: $user_name.\n";
+	} else {
+		print "Failed!\n";
+	}
 
-	print "Testing: Gaim::Account::is_connected()";
-	$user_connected = Gaim::Account::is_connected($account);
-	if (!($user_connected)) { print "...not connected...ok..\n"; } else { print "...connected...ok.\n"; }
+	print "Testing: Gaim::Account::is_connected()... ";
+	if ($account->is_connected()) {
+		print " Connected.\n";
+	} else {
+		print " Disconnected.\n";
+	}
 
-
-	print "Testing: Gaim::Accounts::get_active_status()...";
-	$status = Gaim::Account::get_active_status($account);
-	if ($status) { print "ok.\n"; } else { print "fail.\n"; }
+	print "Testing: Gaim::Accounts::get_active_status()... ";
+	if ($account->get_active_status()) {
+		print "Okay.\n";
+	} else {
+		print "Failed!\n";
+	}
 
 	$account = Gaim::Accounts::find($USERNAME, $PROTOCOL_ID);
 	print "Testing: Gaim::Accounts::connect()...pending...\n";
 	
-	Gaim::Account::set_status($account, "available", TRUE);
-	Gaim::Account::connect($account);
+	$account->set_status("available", TRUE);
+	$account->connect();
 
 	print "\n\n";
 	Gaim::debug_info("plugin_load()", "Testing $MODULE_NAME Completed.");