comparison _test/Test/SQL/Traits.pm @ 167:1f7a6d762394

SQL schema in progress
author sourcer
date Thu, 12 May 2011 08:57:19 +0400
parents 76515373dac0
children 6148f89bb7bf
comparison
equal deleted inserted replaced
166:4267a2ac3d46 167:1f7a6d762394
46 ); 46 );
47 47
48 my $column = $table->Column('id') or failed "Column not found"; 48 my $column = $table->Column('id') or failed "Column not found";
49 49
50 assert( $column->name eq 'id'); 50 assert( $column->name eq 'id');
51 assert( $column->type->isSame(Integer()) ); 51 assert( $column->type->SameValue(Integer()) );
52 assert( not $column->isNullable ); 52 assert( not $column->isNullable );
53 assert( $column->tag->{auto_increment} ); 53 assert( $column->tag->{auto_increment} );
54 54
55 $table->InsertColumn( 55 $table->InsertColumn(
56 new IMPL::SQL::Schema::Traits::Column( 56 new IMPL::SQL::Schema::Traits::Column(
60 60
61 $column = $table->Column('name'); 61 $column = $table->Column('name');
62 62
63 assert($column); 63 assert($column);
64 assert($column->name eq 'name'); 64 assert($column->name eq 'name');
65 assert($column->type->isSame(Varchar(255))); 65 assert($column->type->SameValue(Varchar(255)));
66 assert($column->isNullable); 66 assert($column->isNullable);
67 }; 67 };
68 68
69 test CreateTableWithColumns => sub { 69 test CreateTableWithColumns => sub {
70 my ($this) = @_; 70 my ($this) = @_;
80 ) or failed "Failed to create table"; 80 ) or failed "Failed to create table";
81 81
82 assert( $table->ColumnsCount == 3 ); 82 assert( $table->ColumnsCount == 3 );
83 83
84 assert( my $column = $table->Column('id') ); 84 assert( my $column = $table->Column('id') );
85 assert($column->type->isSame(Varchar(64))); 85 assert($column->type->SameValue(Varchar(64)));
86 assert(not $column->isNullable); 86 assert(not $column->isNullable);
87 87
88 assert( $column = $table->Column('role') ); 88 assert( $column = $table->Column('role') );
89 assert( $column->defaultValue eq 'user' ); 89 assert( $column->defaultValue eq 'user' );
90 }; 90 };