In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/cae9253374c944e001366e50bf6332764c5efeff?hp=3031ec7a1ba26325e256e4b080517b833e15d3e2>
- Log ----------------------------------------------------------------- commit cae9253374c944e001366e50bf6332764c5efeff Merge: 3031ec7 c61bfa6 Author: Tony Cook <[email protected]> Date: Wed Jul 24 15:39:46 2013 +1000 [perl #118923] Add some edge cases to join.t commit c61bfa6a701e953e78a132a0e8c5c48f9f31082e Author: Tony Cook <[email protected]> Date: Wed Jul 24 15:37:37 2013 +1000 join() with an empty list and undef separator may not warn in the future but keep the test to avoid it changing by accident M t/op/join.t commit 99202477d0a815e10039752c76c5b346dd337361 Author: Tony Cook <[email protected]> Date: Wed Jul 24 15:36:42 2013 +1000 add Victor Efimov to AUTHORS M AUTHORS commit cd0ac48477f149b5bcdeccbd7290f72e8c520b4b Author: Victor Efimov <[email protected]> Date: Tue Jul 16 20:39:12 2013 +0400 Add some edge cases to join.t test test what join return if called with empty LIST, also test that it produce warning if separator is undef M t/op/join.t ----------------------------------------------------------------------- Summary of changes: AUTHORS | 1 + t/op/join.t | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 3cc261b..b5adf21 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1154,6 +1154,7 @@ Ulrich Pfeifer <[email protected]> Vadim Konovalov <[email protected]> Valeriy E. Ushakov <[email protected]> Vernon Lyon <[email protected]> +Victor Efimov <[email protected]> Ville Skyttä <[email protected]> Vincent Pit <[email protected]> Vishal Bhatia <[email protected]> diff --git a/t/op/join.t b/t/op/join.t index 9a3dead..f98b5db 100644 --- a/t/op/join.t +++ b/t/op/join.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 22; +plan tests => 26; @x = (1, 2, 3); is( join(':',@x), '1:2:3', 'join an array with character'); @@ -63,6 +63,26 @@ is( $f, 'baeak', 'join back to self, self is join character'); is( $s, "\x{1234}\x{ff}\x{fe}", 'high byte as separator, multi-byte and high byte list'); } +{ my $s = join('x', ()); + is( $s, '', 'join should return empty string for empty list'); +} + +{ my $s = join('', ()); + is( $s, '', 'join should return empty string for empty list and empty separator as well'); +} + +{ my $w; + local $SIG{__WARN__} = sub { $w = shift }; + use warnings "uninitialized"; + my $s = join(undef, ()); + is( $s, '', 'join should return empty string for empty list, when separator is undef'); + # this warning isn't normative, the implementation may choose to + # not evaluate the separator as a string if the list has fewer than + # two elements + like $w, qr/^Use of uninitialized value in join/, "should warn if separator is undef"; +} + + { # [perl #24846] $jb2 should be in bytes, not in utf8. my $b = "abc\304"; my $u = "abc\x{0100}"; -- Perl5 Master Repository
