In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/7cd05e22ffd07c3c595b9feb16b086cdfcb53f7d?hp=402c5d17851279969ceb23dcaeeb4691c114dcbf>
- Log ----------------------------------------------------------------- commit 7cd05e22ffd07c3c595b9feb16b086cdfcb53f7d Author: James E Keenan <[email protected]> Date: Mon Mar 4 19:34:28 2013 -0500 Add Jasmine Ahuja to AUTHORS. M AUTHORS commit ff64f3271fc4db64beb4dff3c26bb792df8dd261 Author: Jasmine Ahuja <[email protected]> Date: Sun Mar 3 22:36:24 2013 -0500 Added descriptions to tests lacking them For: RT #117011 M t/op/chop.t ----------------------------------------------------------------------- Summary of changes: AUTHORS | 1 + t/op/chop.t | 58 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1b09934..c127f0a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -498,6 +498,7 @@ Jan-Pieter Cornet <[email protected]> Jared Rhine <[email protected]> Jari Aalto <[email protected]> Jarkko Hietaniemi <[email protected]> +Jasmine Ahuja <[email protected]> Jason A. Smith <[email protected]> Jason E. Stewart <[email protected]> Jason Hord <[email protected]> diff --git a/t/op/chop.t b/t/op/chop.t index 4aa8db3..3f2247f 100644 --- a/t/op/chop.t +++ b/t/op/chop.t @@ -23,93 +23,93 @@ sub foo { @foo = ("hi \n","there\n","!\n"); @bar = @foo; chop(@bar); -is (join('',@bar), 'hi there!'); +is (join('',@bar), 'hi there!', 'chop list of strings'); $foo = "\n"; chop($foo,@foo); -is (join('',$foo,@foo), 'hi there!'); +is (join('',$foo,@foo), 'hi there!', 'chop on list reduces one-character element to an empty string'); $_ = "foo\n\n"; $got = chomp(); -ok ($got == 1) or print "# got $got\n"; -is ($_, "foo\n"); +is($got, 1, 'check return value when chomp string ending with two newlines; $/ is set to default of one newline'); +is ($_, "foo\n", 'chomp string ending with two newlines while $/ is set to one newline' ); $_ = "foo\n"; $got = chomp(); -ok ($got == 1) or print "# got $got\n"; -is ($_, "foo"); +is($got, 1, 'check return value chomp string ending with one newline while $/ is set to a newline'); +is ($_, "foo", 'test typical use of chomp; chomp a string ending in a single newline while $/ is set to default of one newline'); $_ = "foo"; $got = chomp(); -ok ($got == 0) or print "# got $got\n"; -is ($_, "foo"); +is($got, 0, 'check return value when chomp a string that does not end with current value of $/, 0 should be returned'); +is ($_, "foo", 'chomp a string that does not end with the current value of $/'); $_ = "foo"; $/ = "oo"; $got = chomp(); -ok ($got == 2) or print "# got $got\n"; -is ($_, "f"); +is ($got, "2", 'check return value when chomp string with $/ consisting of more than one character, and with the ending of the string matching $/'); +is ($_, "f", 'chomp a string when $/ consists of two characters that are at the end of the string, check that chomped string contains remnant of original string'); $_ = "bar"; $/ = "oo"; $got = chomp(); -ok ($got == 0) or print "# got $got\n"; -is ($_, "bar"); +is($got, "0", 'check return value when call chomp with $/ consisting of more than one character, and with the ending of the string NOT matching $/'); +is ($_, "bar", 'chomp a string when $/ consists of two characters that are NOT at the end of the string'); $_ = "f\n\n\n\n\n"; $/ = ""; $got = chomp(); -ok ($got == 5) or print "# got $got\n"; -is ($_, "f"); +is ($got, 5, 'check return value when chomp in paragraph mode on string ending with 5 newlines'); +is ($_, "f", 'chomp in paragraph mode on string ending with 5 newlines'); $_ = "f\n\n"; $/ = ""; $got = chomp(); -ok ($got == 2) or print "# got $got\n"; -is ($_, "f"); +is ($got, 2, 'check return value when chomp in paragraph mode on string ending with 2 newlines'); +is ($_, "f", 'chomp in paragraph mode on string ending with 2 newlines'); $_ = "f\n"; $/ = ""; $got = chomp(); -ok ($got == 1) or print "# got $got\n"; -is ($_, "f"); +is ($got, 1, 'check return value when chomp in paragraph mode on string ending with 1 newline'); +is ($_, "f", 'chomp in paragraph mode on string ending with 1 newlines'); $_ = "f"; $/ = ""; $got = chomp(); -ok ($got == 0) or print "# got $got\n"; -is ($_, "f"); +is ($got, 0, 'check return value when chomp in paragraph mode on string ending with no newlines'); +is ($_, "f", 'chomp in paragraph mode on string lacking trailing newlines'); $_ = "xx"; $/ = "xx"; $got = chomp(); -ok ($got == 2) or print "# got $got\n"; -is ($_, ""); +is ($got, 2, 'check return value when chomp string that consists solely of current value of $/'); +is ($_, "", 'chomp on string that consists solely of current value of $/; check that empty string remains'); $_ = "axx"; $/ = "xx"; $got = chomp(); -ok ($got == 2) or print "# got $got\n"; -is ($_, "a"); +is ($got, 2, 'check return value when chomp string that ends with current value of $/. $/ contains two characters'); +is ($_, "a", 'check that when chomp string that ends with currnt value of $/, the part of original string that wasn\'t in $/ remains'); $_ = "axx"; $/ = "yy"; $got = chomp(); -ok ($got == 0) or print "# got $got\n"; -is ($_, "axx"); +is ($got, 0, 'check return value when chomp string that does not end with $/'); +is ($_, "axx", 'chomp a string that does not end with $/, the entire string should remain intact'); # This case once mistakenly behaved like paragraph mode. $_ = "ab\n"; $/ = \3; $got = chomp(); -ok ($got == 0) or print "# got $got\n"; -is ($_, "ab\n"); +is ($got, 0, 'check return value when call chomp with $_ = "ab\\n", $/ = \3' ); +is ($_, "ab\n", 'chomp with $_ = "ab\\n", $/ = \3' ); # Go Unicode. $_ = "abc\x{1234}"; chop; -is ($_, "abc", "Go Unicode"); +is ($_, "abc", 'Go Unicode'); $_ = "abc\x{1234}d"; chop; -- Perl5 Master Repository
