diff _test/Test/SQL/Traits.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents d1676be8afcc
children
line wrap: on
line diff
--- a/_test/Test/SQL/Traits.pm	Tue Apr 10 08:13:22 2012 +0400
+++ b/_test/Test/SQL/Traits.pm	Tue Apr 10 20:08:29 2012 +0400
@@ -12,89 +12,89 @@
 use IMPL::SQL::Types qw(Integer Varchar DateTime);
 
 BEGIN {
-	shared public property schema => prop_all; 
+    shared public property schema => prop_all; 
 }
 
 sub StartUnit {
-	return {
-		schema => new IMPL::SQL::Schema( name => 'testTraits', version => 1 )
-	};
+    return {
+        schema => new IMPL::SQL::Schema( name => 'testTraits', version => 1 )
+    };
 }
 
 test CreateTable => sub {
-	my ($this) = @_;
-	
-	my $table = $this->schema->AddTable(
-		new IMPL::SQL::Schema::Traits::Table(
-			'user'
-		)
-	) or failed "Failed to create table";
-	
-	$this->schema->GetTable('user') or failed "Can't get a created table";
-	
+    my ($this) = @_;
+    
+    my $table = $this->schema->AddTable(
+        new IMPL::SQL::Schema::Traits::Table(
+            'user'
+        )
+    ) or failed "Failed to create table";
+    
+    $this->schema->GetTable('user') or failed "Can't get a created table";
+    
 };
 
 test InsertColumn => sub {
-	my ($this) = @_;
-	
-	my $table = $this->schema->GetTable('user');
-	
-	$table->InsertColumn(
-		new IMPL::SQL::Schema::Traits::Column(
-			id => Integer, tag => { auto_increment => 1 }
-		)
-	);
-	
-	my $column = $table->GetColumn('id') or failed "Column not found";
-	
-	assert( $column->name eq 'id');
-	assert( $column->type->SameValue(Integer()) );
-	assert( not $column->isNullable );
-	assert( $column->tag->{auto_increment} );
-	
-	$table->InsertColumn(
-		new IMPL::SQL::Schema::Traits::Column(
-			name => Varchar(255), isNullable => 1
-		)
-	);
-	
-	$column = $table->GetColumn('name');
-	
-	assert($column);
-	assert($column->name eq 'name');
-	assert($column->type->SameValue(Varchar(255)));
-	assert($column->isNullable);
+    my ($this) = @_;
+    
+    my $table = $this->schema->GetTable('user');
+    
+    $table->InsertColumn(
+        new IMPL::SQL::Schema::Traits::Column(
+            id => Integer, tag => { auto_increment => 1 }
+        )
+    );
+    
+    my $column = $table->GetColumn('id') or failed "Column not found";
+    
+    assert( $column->name eq 'id');
+    assert( $column->type->SameValue(Integer()) );
+    assert( not $column->isNullable );
+    assert( $column->tag->{auto_increment} );
+    
+    $table->InsertColumn(
+        new IMPL::SQL::Schema::Traits::Column(
+            name => Varchar(255), isNullable => 1
+        )
+    );
+    
+    $column = $table->GetColumn('name');
+    
+    assert($column);
+    assert($column->name eq 'name');
+    assert($column->type->SameValue(Varchar(255)));
+    assert($column->isNullable);
 };
 
 test CreateTableWithColumns => sub {
-	my ($this) = @_;
-	
-	my $table = $this->schema->AddTable(
-		new IMPL::SQL::Schema::Traits::Table(
-			session => [
-				new IMPL::SQL::Schema::Traits::Column( id => Varchar(64)),
-				new IMPL::SQL::Schema::Traits::Column( expires => DateTime ),
-				new IMPL::SQL::Schema::Traits::Column( role => Varchar(64), defaultValue => 'user' )
-			]
-		)
-	) or failed "Failed to create table";
-	
-	assert( $table->ColumnsCount == 3 );
-	
-	assert( my $column = $table->GetColumn('id') );
-	assert($column->type->SameValue(Varchar(64)));
-	assert(not $column->isNullable);
-	
-	assert( $column = $table->GetColumn('role') );
-	assert( $column->defaultValue eq 'user' );
+    my ($this) = @_;
+    
+    my $table = $this->schema->AddTable(
+        new IMPL::SQL::Schema::Traits::Table(
+            session => [
+                new IMPL::SQL::Schema::Traits::Column( id => Varchar(64)),
+                new IMPL::SQL::Schema::Traits::Column( expires => DateTime ),
+                new IMPL::SQL::Schema::Traits::Column( role => Varchar(64), defaultValue => 'user' )
+            ]
+        )
+    ) or failed "Failed to create table";
+    
+    assert( $table->ColumnsCount == 3 );
+    
+    assert( my $column = $table->GetColumn('id') );
+    assert($column->type->SameValue(Varchar(64)));
+    assert(not $column->isNullable);
+    
+    assert( $column = $table->GetColumn('role') );
+    assert( $column->defaultValue eq 'user' );
 };
 
 sub FinishUnit {
-	my ($self,$session) = @_;
-	
-	$self->supercall::FinishUnit();
-	
-	$session->{schema}->Dispose();
+    my ($self,$session) = @_;
+    
+    $self->supercall::FinishUnit();
+    
+    $session->{schema}->Dispose();
 }
 
 1;