3 use Test::More tests => 18;
4 use DBIx::Class::Schema::Loader::Utils 'split_name';
6 is_deeply [split_name('foo_bar_baz')], [qw/foo bar baz/],
9 is_deeply [split_name('foo__bar__baz')], [qw/foo bar baz/],
10 'by double underscore';
12 is_deeply [split_name('Foo_Bar_Baz')], [qw/Foo Bar Baz/],
13 'by underscore with full capitalization';
15 is_deeply [split_name('foo_Bar_Baz')], [qw/foo Bar Baz/],
16 'by underscore with lcfirst capitalization';
18 is_deeply [split_name('fooBarBaz')], [qw/foo Bar Baz/],
19 'lcfirst camelCase identifier';
21 is_deeply [split_name('FooBarBaz')], [qw/Foo Bar Baz/],
22 'ucfirst camelCase identifier';
24 is_deeply [split_name('VLANValidID')], [qw/VLAN Valid ID/],
25 'CAMELCase identifier (word with all caps)';
27 is_deeply [split_name('VlanVALIDId')], [qw/Vlan VALID Id/],
28 'CamelCASE identifier (second word with all caps)';
30 is_deeply [split_name('foo..bar/baz')], [qw/foo bar baz/],
31 'by non-alphanum chars';
35 is_deeply [split_name('foo_bar_baz', 7)], [qw/foo bar baz/],
36 'by underscore for v=7';
38 is_deeply [split_name('foo__bar__baz', 7)], [qw/foo bar baz/],
39 'by double underscore for v=7';
41 is_deeply [split_name('Foo_Bar_Baz', 7)], [qw/Foo Bar Baz/],
42 'by underscore with full capitalization for v=7';
44 is_deeply [split_name('foo_Bar_Baz', 7)], [qw/foo Bar Baz/],
45 'by underscore with lcfirst capitalization for v=7';
47 is_deeply [split_name('fooBarBaz', 7)], [qw/foo Bar Baz/],
48 'lcfirst camelCase identifier for v=7';
50 is_deeply [split_name('FooBarBaz', 7)], [qw/Foo Bar Baz/],
51 'ucfirst camelCase identifier for v=7';
53 is_deeply [split_name('VLANValidID', 7)], [qw/VLANValid ID/],
54 'CAMELCase identifier (word with all caps) for v=7';
56 is_deeply [split_name('VlanVALIDId', 7)], [qw/Vlan VALIDId/],
57 'CamelCASE identifier (second word with all caps) for v=7';
59 is_deeply [split_name('foo..bar/baz', 7)], [qw/foo bar baz/],
60 'by non-alphanum chars for v=7';