Support identity columns in PostgreSQL v10
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 80split_name.t
CommitLineData
ea3b8f03 1use strict;
2use warnings;
3use Test::More tests => 18;
4use DBIx::Class::Schema::Loader::Utils 'split_name';
5
6is_deeply [split_name('foo_bar_baz')], [qw/foo bar baz/],
7 'by underscore';
8
9is_deeply [split_name('foo__bar__baz')], [qw/foo bar baz/],
10 'by double underscore';
11
12is_deeply [split_name('Foo_Bar_Baz')], [qw/Foo Bar Baz/],
13 'by underscore with full capitalization';
14
15is_deeply [split_name('foo_Bar_Baz')], [qw/foo Bar Baz/],
16 'by underscore with lcfirst capitalization';
17
18is_deeply [split_name('fooBarBaz')], [qw/foo Bar Baz/],
19 'lcfirst camelCase identifier';
20
21is_deeply [split_name('FooBarBaz')], [qw/Foo Bar Baz/],
22 'ucfirst camelCase identifier';
23
24is_deeply [split_name('VLANValidID')], [qw/VLAN Valid ID/],
25 'CAMELCase identifier (word with all caps)';
26
27is_deeply [split_name('VlanVALIDId')], [qw/Vlan VALID Id/],
28 'CamelCASE identifier (second word with all caps)';
29
30is_deeply [split_name('foo..bar/baz')], [qw/foo bar baz/],
31 'by non-alphanum chars';
32
33# naming=v7
34
35is_deeply [split_name('foo_bar_baz', 7)], [qw/foo bar baz/],
36 'by underscore for v=7';
37
38is_deeply [split_name('foo__bar__baz', 7)], [qw/foo bar baz/],
39 'by double underscore for v=7';
40
41is_deeply [split_name('Foo_Bar_Baz', 7)], [qw/Foo Bar Baz/],
42 'by underscore with full capitalization for v=7';
43
44is_deeply [split_name('foo_Bar_Baz', 7)], [qw/foo Bar Baz/],
45 'by underscore with lcfirst capitalization for v=7';
46
47is_deeply [split_name('fooBarBaz', 7)], [qw/foo Bar Baz/],
48 'lcfirst camelCase identifier for v=7';
49
50is_deeply [split_name('FooBarBaz', 7)], [qw/Foo Bar Baz/],
51 'ucfirst camelCase identifier for v=7';
52
53is_deeply [split_name('VLANValidID', 7)], [qw/VLANValid ID/],
54 'CAMELCase identifier (word with all caps) for v=7';
55
56is_deeply [split_name('VlanVALIDId', 7)], [qw/Vlan VALIDId/],
57 'CamelCASE identifier (second word with all caps) for v=7';
58
59is_deeply [split_name('foo..bar/baz', 7)], [qw/foo bar baz/],
60 'by non-alphanum chars for v=7';