Ben Moon
0929a393a6
Remove unnecessary helper
...
@mintsoft Thus I reduce my laziness...
2016-07-11 15:57:43 +01:00
Ben Moon
69083246ed
Add 'join_last' option
2016-07-11 11:04:00 +01:00
Ben Moon
4a6c23f048
Add 'join' option for formatting
2016-07-11 11:04:00 +01:00
Ben Moon
d61bb26fa1
Add support for varying nested parentheses format
...
So `parens => '({})'` would format as '(1, {2, 3}, 4)'.
2016-07-11 11:03:59 +01:00
Ben Moon
c24ecdf3d8
Improve support for 'empty' parentheses
...
When the user uses "parens => ''" in format_list.
2016-07-11 11:03:59 +01:00
Ben Moon
e3cd02900c
Add 'parens' option to 'format_list'
...
Allow specifying which parentheses should be used when formatting.
2016-07-11 11:03:59 +01:00
Ben Moon
0e0fcbc3af
Default 'nested' to false if 'item' is provided
...
Generally, if an item regex is provided we won't be working with a
nested list, so turn nesting off.
Also improve validation for nested items.
2016-07-11 11:03:59 +01:00
Ben Moon
8e2dd40e7b
Add test for explicitly enabled nesting
...
And clean the tests up a bit too.
2016-07-11 11:03:59 +01:00
Ben Moon
e0017279ef
Add support for parsing nested lists
2016-07-11 11:03:59 +01:00
Ben Moon
05343878a5
Move valid and invalid item regex tests to subtest
...
So we can show which regex is being tested.
2016-07-11 11:03:59 +01:00
Ben Moon
f41a797adc
Add test for undefined input to parse
2016-07-11 11:03:59 +01:00
Ben Moon
b05fff92a7
Add support for basic formatting
...
Currently only formatting as a standard ARRAY is supported. TODO:
support separators/brackets (and perhaps detected from previous
parsing).
2016-07-11 11:03:58 +01:00
Ben Moon
82c0840185
Allow specifying a regex each item must match
...
For example `parse_list($text, item => qr/\d+/)` would only allow
digits.
2016-07-11 11:03:58 +01:00
Ben Moon
11b2ec875f
Add test for empty string (invalid)
2016-07-11 11:03:58 +01:00
Ben Moon
fb2a722b9f
Add test for varying separators
2016-07-11 11:03:58 +01:00
Ben Moon
408c76f2a2
Allow lists without brackets
2016-07-11 11:03:58 +01:00
Ben Moon
f379ce0d39
Fix check for defined result
...
Tests get confusing with Test::Deep if $got is undefined (and isn't
passed explicitly). e.g.,
`cmp_deeply(ListTester::parse_list($to_parse)...`.
2016-07-11 11:03:58 +01:00
Ben Moon
a3a08de2a3
Pull common list-parsing test into sub
2016-07-11 11:03:58 +01:00
Ben Moon
7874e86491
Add test for number of items
...
Corrected regex to allow for empty list
2016-07-11 11:03:58 +01:00
Ben Moon
45e8bd8200
Add test for varying brackets
...
Also, return an ARRAY reference instead of a list (at least for now);
not sure which will make more sense in the future (probably just a
list).
/cc @mintsoft
2016-07-11 11:03:58 +01:00
Ben Moon
8556e46930
Add 'initialization' test
2016-07-11 11:03:57 +01:00