develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33512 - trunk/ext/SQLite3

From:
petdance
Date:
December 5, 2008 08:03
Subject:
[svn:parrot] r33512 - trunk/ext/SQLite3
Message ID:
20081205160255.CDF9ECB9AF@x12.develooper.com
Author: petdance
Date: Fri Dec  5 08:02:54 2008
New Revision: 33512

Modified:
   trunk/ext/SQLite3/test.p6

Log:
Andy makes some test fairy notes

Modified: trunk/ext/SQLite3/test.p6
==============================================================================
--- trunk/ext/SQLite3/test.p6	(original)
+++ trunk/ext/SQLite3/test.p6	Fri Dec  5 08:02:54 2008
@@ -1,12 +1,20 @@
+# Andy the time-strapped test fairy says:
+# If this were Perl 5, I'd put in tests roughly like the following:
 use DBDI;
 my $conn = DBDI::DriverManager.getConnection("dbdi:SQLite3:test.db", "", "");
+### isa_ok($conn, 'DBDI::DriverManager');
 my $stm = $conn.createStatement();
+### isa_ok($stm, 'DBDI::Statement');
 my $rs = $stm.executeUpdate("CREATE TABLE foo (bar, baz)");
+### ok( $rs->success, 'Created foo OK');
+### I'd also add a test that a SELECT works and returns 0 rows
 
 my $stm = $conn.prepareStatement("INSERT INTO foo (bar, baz) VALUES (?, ?)");
+### isa_ok( $stm, 'DBDI::PreparedStatement');
 $stm.bind(1, 123);
 $stm.bind(2, "Thingy");
 $stm.executeUpdate();
+### is( $stm->rowsAffected, 1, 'Inserted one row' );
 
 my $stm2 = $conn.createStatement();
 my $rs = $stm2.executeQuery("SELECT baz, bar FROM foo");
@@ -14,3 +22,4 @@
     say $rs.getCol(1);
     say $rs.getCol("baz");
 }
+### Check that we got back exactly one row.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About