From: Mark Addison Date: Mon, 29 Mar 2004 10:20:47 +0000 (+0000) Subject: Tests of Constraint::fields() object return and Constraint::field_names(). X-Git-Tag: v0.06~113 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e21fb9ddcbc950972543edee7cd4c30a2af54978;p=dbsrgits%2FSQL-Translator.git Tests of Constraint::fields() object return and Constraint::field_names(). --- diff --git a/t/13schema.t b/t/13schema.t index 073ff8d..981c252 100644 --- a/t/13schema.t +++ b/t/13schema.t @@ -4,7 +4,7 @@ $| = 1; use strict; -use Test::More tests => 199; +use Test::More tests => 201; use SQL::Translator::Schema::Constants; require_ok( 'SQL::Translator::Schema' ); @@ -236,6 +236,10 @@ require_ok( 'SQL::Translator::Schema' ); $fields = join(',', $constraint1->fields('age') ); is( $fields, 'age', 'Constraint field = "age"' ); + $fields = $constraint1->fields; + ok( ref $fields[0] && $fields[0]->isa("SQL::Translator::Schema::Field"), + 'Constraint fields returns a SQL::Translator::Schema::Field' ); + $fields = join(',', $constraint1->fields('age,age') ); is( $fields, 'age', 'Constraint field = "age"' ); @@ -254,6 +258,9 @@ require_ok( 'SQL::Translator::Schema' ); $fields = join(',', $constraint1->fields( qw[ age name ] ) ); is( $fields, 'age,name', 'Constraint field = "age,name"' ); + $fields = join(',', $constraint1->field_names ); + is( $fields, 'age,name', 'Constraint field_names = "age,name"' ); + is( $constraint1->match_type, '', 'Constraint match type is empty' ); is( $constraint1->match_type('foo'), undef, 'Constraint match type rejects bad arg...' );