~ubuntu-branches/ubuntu/precise/libtangram-perl/precise

« back to all changes in this revision

Viewing changes to t/springfield/04-tx.t

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-04-05 16:56:20 UTC
  • mfrom: (3.1.2 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080405165620-ujjtum3d65q3hpno
Tags: 2.10-1.1
* Non-maintainer upload.
* Fix FTBFS with Perl 5.10.  Closes: #468014.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
use strict;
 
4
use lib 't/springfield';
 
5
use Springfield;
 
6
 
 
7
Springfield::begin_tests(4);
 
8
 
 
9
Springfield::connect_empty()->disconnect(); # init $no_tx
 
10
 
 
11
Springfield::tx_tests(4, sub {
 
12
 
 
13
{
 
14
   my $storage = Springfield::connect_empty;
 
15
   my $homer = NaturalPerson->new( firstName => 'Homer', name => 'Simpson' );
 
16
 
 
17
   Springfield::test( !defined $storage->id( $homer ) );
 
18
 
 
19
   eval
 
20
   {
 
21
      $storage->tx_do(
 
22
         sub
 
23
         {
 
24
            $storage->insert( $homer );
 
25
            Springfield::test( defined $storage->id( $homer ) );
 
26
            die;
 
27
         } );
 
28
   };
 
29
 
 
30
   Springfield::test( !defined $storage->id( $homer ) );
 
31
 
 
32
   $storage->disconnect();
 
33
}
 
34
 
 
35
Springfield::leaktest;
 
36
 
 
37
} ); # tx_tests