[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6681] trunk/t



Revision: 6681
          http://sourceforge.net/p/ledger-smb/code/6681
Author:   einhverfr
Date:     2014-01-28 09:48:37 +0000 (Tue, 28 Jan 2014)
Log Message:
-----------
All basic non-POD tests now passing

Modified Paths:
--------------
    trunk/t/03-date-handling.t
    trunk/t/11-ledgersmb.t

Modified: trunk/t/03-date-handling.t
===================================================================
--- trunk/t/03-date-handling.t	2014-01-28 09:39:42 UTC (rev 6680)
+++ trunk/t/03-date-handling.t	2014-01-28 09:48:37 UTC (rev 6681)
@@ -101,17 +101,10 @@
 	my $yearcount = $formats[$format][2];
 	cmp_ok($form->datetonum(\%myconfig, $formats[$format][3]), 'eq',
 		'20000229', "form: datetonum, $fmt");
-	cmp_ok($lsmb->date_to_number('user' => \%myconfig, 
-		'date' => $formats[$format][3]), 'eq',
-		'20000229', "lsmb: date_to_number, $fmt");
 }
 cmp_ok($form->datetonum(\%myconfig), 'eq', '', "form: datetonum, empty string");
 cmp_ok($form->datetonum(\%myconfig, '1234'), 'eq', '1234', 
 	"form: datetonum, 1234");
-cmp_ok($lsmb->date_to_number('user' => \%myconfig), 'eq', '', 
-	"lsmb: date_to_number, empty date");
-cmp_ok($lsmb->date_to_number('user' => \%myconfig, 'date' => '1234'), 
-	'eq', '1234', "lsmb: date_to_number, 1234");
 
 # $form->split_date checks
 # Note that $form->split_date assumes the year range 2000-2099

Modified: trunk/t/11-ledgersmb.t
===================================================================
--- trunk/t/11-ledgersmb.t	2014-01-28 09:39:42 UTC (rev 6680)
+++ trunk/t/11-ledgersmb.t	2014-01-28 09:48:37 UTC (rev 6681)
@@ -13,13 +13,13 @@
 
 use LedgerSMB::Sysconfig;
 use LedgerSMB;
+use LedgerSMB::App_State;
 my $lsmb;
 if ($ENV{PGDATABASE}){
-    plan tests => 96;
+    plan tests => 61;
 } else {
-    plan tests => 92;
+    plan tests => 57;
 }
-$LedgerSMB::App_State::DBH =  DBI->connect('dbi:Pg:');
 
 
 
@@ -56,32 +56,7 @@
 $lsmb = LedgerSMB->new();
 $utfstr = "\xd8\xad";
 utf8::decode($utfstr);
-ok(!$lsmb->escape, 'escape: (undef)');
-ok(!$lsmb->escape('foo' => 'bar'), 'escape: (invalid args)');
-cmp_ok($lsmb->escape('string' => ' '), 'eq', '%20',
-	'escape: \' \'');
-cmp_ok($lsmb->escape('string' => 'foo'), 'eq', 'foo', 
-	'escape: foo');
-cmp_ok($lsmb->escape('string' => 'foo bar'), 'eq', 'foo%20bar', 
-	'escape: foo bar');
-TODO: {
-	local $TODO = 'Fun with Unicode';
-	cmp_ok($lsmb->escape('string' => $utfstr), 'eq', '%d8%ad', 
-		'escape: U+D8AD');
-}
 
-# $lsmb->is_blank checks
-$lsmb = LedgerSMB->new();
-$lsmb->{blank} = '    ';
-$lsmb->{notblank} = ' d   ';
-TODO: {
-	local $TODO = 'Errors should be thrown';
-	throws_ok{$lsmb->is_blank} 'Error::Simple', 'is_blank: (undef)';
-	throws_ok{$lsmb->is_blank('foo' => 'bar')} 'Error::Simple', 
-		'is_blank: (invalid args)';
-}
-is($lsmb->is_blank('name' => 'notblank'), 0, 'is_blank: notblank');
-is($lsmb->is_blank('name' => 'blank'), 1, 'is_blank: blank');
 
 # $lsmb->is_run_mode checks
 $lsmb = LedgerSMB->new();
@@ -110,66 +85,7 @@
 is($lsmb->is_run_mode('foo'), 0, 'is_run_mode: CLI - (bad mode)');
 is($lsmb->is_run_mode, 0, 'is_run_mode: CLI - (unknown mode)');
 
-# $lsmb->num_text_rows checks
-$lsmb = LedgerSMB->new();
-is($lsmb->num_text_rows('string' => "apple\npear", 'cols' => 10, 'max' => 5),
-	2, 'num_text_rows: 2 rows, no column breakage, max 5 rows');
-is($lsmb->num_text_rows('string' => "apple\npear", 'cols' => 10, 'max' => 1),
-	1, 'num_text_rows: 2 rows, no column breakage, max 1 row');
-is($lsmb->num_text_rows('string' => "apple\npear", 'cols' => 10, 'max' => 2),
-	2, 'num_text_rows: 2 rows, no column breakage, max 2 rows');
-is($lsmb->num_text_rows('string' => "apple\npear", 'cols' => 10),
-	2, 'num_text_rows: 2 rows, no column breakage, no max row count');
-is($lsmb->num_text_rows('string' => "01234567890123456789", 'cols' => 10),
-	2, 'num_text_rows: 2 rows, non-word column breakage, no max row count');
-is($lsmb->num_text_rows('string' => "012345 67890123 456789", 'cols' => 10),
-	3, 'num_text_rows: 3 rows, word column breakage, no max row count');
-is($lsmb->num_text_rows('string' => "0123456789", 'cols' => 10),
-	1, 'num_text_rows: 1 rows, no breakage, max cols, no max row count');
-is($lsmb->num_text_rows('string' => "01234567890", 'cols' => 10),
-	2, 'num_text_rows: 2 rows, no breakage, max cols+1, no max row count');
-is($lsmb->num_text_rows('string' => "1\n\n2", 'cols' => 10),
-	3, 'num_text_rows: 3 rows, no breakage, blank line, no max row count');
-is($lsmb->num_text_rows('string' => "012345 67890123456789", 'cols' => 10),
-	3, 'num_text_rows: 3 rows, word and non column breakage, no max row count');
 
-# $lsmb->debug checks
-$lsmb = LedgerSMB->new();
-@r = trap{$lsmb->debug()};
-#SKIP: {like($trap->stdout, qr|\n\$VAR1 = bless\( {[\n\s]+'action' => '',[\n\s]+'dbversion' => '\d+\.\d+\.\d+',[\n\s]+'path' => 'bin/mozilla',[\n\s]+'version' => '$lsmb->{version}'[\n\s]+}, 'LedgerSMB' \);|,
-#	'debug: $lsmb->debug');
-#}
-SKIP: {
-	skip 'Environment for file test not clean' if -f "t/var/lsmb-11.$$";
-	$lsmb->{file} = "t/var/lsmb-11.$$";
-	$lsmb->debug({'file' => $lsmb->{file}});
-	ok(-f "t/var/lsmb-11.$$", "debug: output file t/var/lsmb-11.$$ created");
-	open(my $FH, '<', "t/var/lsmb-11.$$");
-	my @str = <$FH>;
-	close($FH);
-	chomp(@str);
-	cmp_ok(grep (/\s?\$VAR1\s=\sbless/, @str), '>', 0, 
-		'Debug Contents, var1 type'); 
-	cmp_ok(grep (/'action' => ''/, @str), '>', 0,
-		'Debug contents, blank action');
-	cmp_ok(grep (/'dbversion' => '\d+\.\d+\.\d+'/, @str), '>', 0,
-		'Debug contents, dbversion format');
-	cmp_ok(grep (/'path' => 'bin\/mozilla'/, @str), '>', 0,
-		'Debug contents, path');
-	cmp_ok(grep (/'version' => '$lsmb->{version}'/, @str), '>', 0,
-		'Debug contents, version match');
-	cmp_ok(grep (/'file' => 't\/var\/lsmb-11.$$'/, @str), '>', 0,
-		'Debug contents file attribute match');
-	is(unlink("t/var/lsmb-11.$$"), 1, "debug: removing t/var/lsmb-11.$$");
-	ok(!-e "t/var/lsmb-11.$$", "debug: t/var/lsmb-11.$$ removed");
-};
-
-$lsmb->{file} = 't/this is a bad directory, I do not exist/foo';
-@r = trap {$lsmb->debug({'file' => $lsmb->{file}, $lsmb})};
-like($trap->die, qr/No such file or directory/,
-	"debug: open failure causes death");
-ok(!-e $lsmb->{file}, "debug: file creation failed");
-
 # $lsmb->new checks
 $lsmb = LedgerSMB->new();
 ok(defined $lsmb, 'new: blank, defined');
@@ -194,22 +110,6 @@
 is($lsmb->{menubar}, 1, 'new: lynx, menubar enabled (deprecated)');
 ok(defined $lsmb->{version}, 'new: lynx, version defined');
 
-# $lsmb->redirect checks
-$lsmb = LedgerSMB->new();
-ok(!defined $lsmb->{callback}, 'redirect: No callback set');
-@r = trap{$lsmb->redirect};
-is($trap->stdout, "redirected\n", 'redirect: No message or callback redirect');
-#TODO: {
-	#local $TODO = '$lsmb->info for LedgerSMB';
-	#@r = trap{$lsmb->redirect('msg' => 'hello world')};
-	#is($trap->stdout, "hello world\n", 
-	#	'redirect: message, no callback redirect');
-#}
-$lsmb->{callback} = 1;
-@r = trap{$lsmb->redirect};
-is($trap->stdout, "redirected\n", 'redirect: callback, no message redirect');
-@r = trap{$lsmb->redirect('msg' => "hello world\n")};
-is($trap->stdout, "redirected\n", 'redirect: callback and message redirect');
 
 # $lsmb->call_procedure checks
 SKIP: {
@@ -218,6 +118,7 @@
 	$lsmb = LedgerSMB->new();
 	$lsmb->{dbh} = DBI->connect("dbi:Pg:dbname=$ENV{PGDATABASE}", 
 		undef, undef, {AutoCommit => 0 });
+        LedgerSMB::App_State::set_DBH($lsmb->{dbh});
 	@r = $lsmb->call_procedure('procname' => 'character_length', 
 		'args' => ['month'], 'schema'=>"pg_catalog");
 	is($#r, 0, 'call_procedure: correct return length (one row)');

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits