Fixed examples
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 002_types.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 7;
5
6 use MooseX::Types::Moose qw/ArrayRef Str Int Ref HashRef/;
7 use SQL::Abstract::Types ':all';
8
9 is(ArrayAST->validate( [ -foo => 'bar' ] ), undef, "is_ArrayAST with valid" );
10 ok(!is_ArrayAST( [ foo => 'bar' ] ), "is_ArrayAST with invalid" );
11
12
13 is(HashAST->validate( { -type => 'select', select => [] } ), undef, "is_HashAST with valid" );
14 ok(!is_HashAST( { foo => 'bar' } ), "is_HashAST with invalid" );
15
16
17 is(AST->validate( { -type => 'select', select => [] } ), undef, "is_AST with valid hash" );
18 is(AST->validate( [ -name => 1, 2 ] ), undef, "is_AST with valid array" );
19
20 is(is_AST([ -name => qw/me id/]), 1);