[Bps-public-commit] r12444 - in Prophet/trunk: .
jesse at bestpractical.com
jesse at bestpractical.com
Sat May 17 05:31:55 EDT 2008
Author: jesse
Date: Sat May 17 05:31:54 2008
New Revision: 12444
Added:
Prophet/trunk/t/luid.t
Modified:
Prophet/trunk/ (props changed)
Log:
r31109 at dhcp113 (orig r12378): sartak | 2008-05-16 19:50:52 +0900
r55970 at onn: sartak | 2008-05-16 06:50:37 -0400
Basic tests for luid
Added: Prophet/trunk/t/luid.t
==============================================================================
--- (empty file)
+++ Prophet/trunk/t/luid.t Sat May 17 05:31:54 2008
@@ -0,0 +1,36 @@
+use warnings;
+use strict;
+use Test::More tests => 10;
+
+use File::Temp qw'tempdir';
+
+use_ok('Prophet::CLI');
+$ENV{'PROPHET_REPO'} = tempdir( CLEANUP => 0 ) . '/repo-' . $$;
+my $cli = Prophet::CLI->new();
+my $cxn = $cli->app_handle->handle;
+
+my $record = Prophet::Record->new(handle => $cxn, type => 'Empty');
+my $uuid = $record->create(props => {});
+my $luid = $record->luid;
+ok($uuid, "got a uuid");
+ok($luid, "got a luid");
+
+$record = Prophet::Record->new(handle => $cxn, type => 'Empty');
+$record->load(uuid => $uuid);
+is($record->uuid, $uuid, "load accepts a uuid");
+
+$record = Prophet::Record->new(handle => $cxn, type => 'Empty');
+$record->load(luid => $luid);
+is($record->uuid, $uuid, "load accepts an luid");
+is($record->luid, $luid, "same luid after load");
+
+my $record2 = Prophet::Record->new(handle => $cxn, type => 'Empty');
+my $uuid2 = $record2->create(props => {});
+my $luid2 = $record2->luid;
+isnt($uuid, $uuid2, "different uuids");
+isnt($luid, $luid2, "different luids");
+
+$record2 = Prophet::Record->new(handle => $cxn, type => 'Empty');
+$record2->load(luid => $luid2);
+is($record2->uuid, $uuid2, "load accepts an luid");
+is($record2->luid, $luid2, "same luid after load");
More information about the Bps-public-commit
mailing list