From: Peter Rabbitson <ribasushi@cpan.org>
Date: Sat, 9 Jan 2010 00:35:34 +0000 (+0000)
Subject: Test for the real leak reason
X-Git-Tag: v0.08116~64^2~3
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=06e15b8e4da7d663ddfaad70f935a096af015fbb;p=dbsrgits%2FDBIx-Class.git

Test for the real leak reason
---

diff --git a/t/99dbic_sqlt_parser.t b/t/99dbic_sqlt_parser.t
index f8b88c3..7f05034 100644
--- a/t/99dbic_sqlt_parser.t
+++ b/t/99dbic_sqlt_parser.t
@@ -5,6 +5,8 @@ use Test::More;
 use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
+use DBICTest::Schema;
+use Scalar::Util ();
 
 BEGIN {
   require DBIx::Class::Storage::DBI;
@@ -13,6 +15,16 @@ BEGIN {
     if not DBIx::Class::Storage::DBI->_sqlt_version_ok;
 }
 
+# Test for SQLT-related leaks
+{
+  my $s = DBICTest::Schema->clone;
+  my $sqlt_s = create_schema ({ schema => $s });
+  Scalar::Util::weaken ($s);
+
+  ok (!$s, 'Schema not leaked');
+}
+
+
 my $schema = DBICTest->init_schema();
 # Dummy was yanked out by the sqlt hook test
 # CustomSql tests the horrific/deprecated ->name(\$sql) hack
diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm
index 852d07a..66a79e8 100644
--- a/t/lib/DBICTest.pm
+++ b/t/lib/DBICTest.pm
@@ -127,7 +127,7 @@ sub deploy_schema {
     my $args = shift || {};
 
     if ($ENV{"DBICTEST_SQLT_DEPLOY"}) { 
-        $schema->deploy($args);    
+        $schema->deploy($args);
     } else {
         open IN, "t/lib/sqlite.sql";
         my $sql;