diff options
Diffstat (limited to 'Tools/Scripts/webkitperl/VCSUtils_unittest')
5 files changed, 208 insertions, 3 deletions
diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl index cda5d2829..caee50b16 100644 --- a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl +++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl @@ -2,6 +2,7 @@ # # Copyright (C) 2011 Research In Motion Limited. All rights reserved. # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) +# Copyright (C) 2012 Daniel Bates (dbates@intudata.com) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -148,6 +149,35 @@ my @testCaseHashRefs = ( ] }, ### +# Simple SVN 1.7 property diff chunk range tests +## +{ # New test + testName => "Line count is 0", + inputText => "## -0,0 +1,4 ##", + chunkSentinel => "##", + expectedReturn => [ +{ + startingLine => 0, + lineCount => 0, + newStartingLine => 1, + newLineCount => 4, +} +] +}, +{ # New test + testName => "New line count is 1", + inputText => "## -0,0 +1 ##", + chunkSentinel => "##", + expectedReturn => [ +{ + startingLine => 0, + lineCount => 0, + newStartingLine => 1, + newLineCount => 1, +} +] +}, +### # Chunk range followed by ending junk ## { # New test @@ -230,7 +260,7 @@ plan(tests => $testCasesCount); foreach my $testCase (@testCaseHashRefs) { my $testNameStart = "parseChunkRange(): $testCase->{testName}: comparing"; - my @got = VCSUtils::parseChunkRange($testCase->{inputText}); + my @got = VCSUtils::parseChunkRange($testCase->{inputText}, $testCase->{chunkSentinel}); my $expectedReturn = $testCase->{expectedReturn}; is_deeply(\@got, $expectedReturn, "$testNameStart return value."); diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl index 4f054318a..7c3d98c9a 100644 --- a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl +++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl @@ -2,6 +2,7 @@ # # Copyright (C) Research in Motion Limited 2010. All Rights Reserved. # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) +# Copyright (C) 2012 Daniel Bates (dbates@intudata.com) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -249,6 +250,51 @@ undef], }, { # New test + diffName => "svn:executable followed by custom property using SVN 1.7 syntax", + inputText => <<'END', +Property changes on: FileA +___________________________________________________________________ +Added: svn:executable +## -0,0 +1 ## ++* +\ No newline at end of property +Added: documentation +## -0,0 +1 ## ++This is an example sentence. +END + expectedReturn => [ +{ + propertyPath => "FileA", + executableBitDelta => 1, +}, +undef], + expectedNextLine => undef, +}, +{ + # New test + diffName => "svn:executable followed by custom property without newline using SVN 1.7 syntax", + inputText => <<'END', +Property changes on: FileA +___________________________________________________________________ +Added: svn:executable +## -0,0 +1 ## ++* +\ No newline at end of property +Added: documentation +## -0,0 +1 ## ++This is an example sentence. +\ No newline at end of property +END + expectedReturn => [ +{ + propertyPath => "FileA", + executableBitDelta => 1, +}, +undef], + expectedNextLine => undef, +}, +{ + # New test diffName => "custom property followed by svn:executable", inputText => <<'END', Property changes on: FileA diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl index 8df04bc8b..fc357c901 100644 --- a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl +++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl -w # # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) +# Copyright (C) 2012 Daniel Bates (dbates@intudata.com) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -216,12 +217,54 @@ END Index: test_file.swf =================================================================== Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream + +END + indexPath => "test_file.swf", + isBinary => 1, +}, +"Property changes on: test_file.swf\n"], + expectedNextLine => "___________________________________________________________________\n", +}, +{ + # New test + diffName => "binary file using SVN 1.7 syntax", + inputText => <<'END', +Index: test_file.swf +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: test_file.swf +=================================================================== +--- test_file.swf ++++ test_file.swf + +Property changes on: test_file.swf +___________________________________________________________________ +Added: svn:mime-type +## -0,0 +1 ## ++application/octet-stream +\ No newline at end of property + +Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== +END + expectedReturn => [ +{ + svnConvertedText => <<'END', +Index: test_file.swf +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: test_file.swf +=================================================================== +--- test_file.swf ++++ test_file.swf END indexPath => "test_file.swf", isBinary => 1, }, -"svn:mime-type = application/octet-stream\n"], - expectedNextLine => "\n", +"\n"], + expectedNextLine => "Property changes on: test_file.swf\n", }, ); diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl index 691405121..a613bde76 100644 --- a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl +++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl @@ -2,6 +2,7 @@ # # Copyright (C) Research in Motion Limited 2010. All Rights Reserved. # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) +# Copyright (C) 2012 Daniel Bates (dbates@intudata.com) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -175,6 +176,67 @@ undef], expectedNextLine => undef, }, #### +# Using SVN 1.7 syntax +## +{ + # New test + diffName => "simple: add svn:executable using SVN 1.7 syntax", + inputText => <<'END', +Added: svn:executable +## -0,0 +1 ## ++* +\ No newline at end of property +END + expectedReturn => [ +{ + name => "svn:executable", + propertyChangeDelta => 1, + value => "*", +}, +undef], + expectedNextLine => undef, +}, +{ + # New test + diffName => "simple: delete svn:executable using SVN 1.7 syntax", + inputText => <<'END', +Deleted: svn:executable +## -1 +0,0 ## +-* +\ No newline at end of property +END + expectedReturn => [ +{ + name => "svn:executable", + propertyChangeDelta => -1, + value => "*", +}, +undef], + expectedNextLine => undef, +}, +{ + # New test + diffName => "add svn:mime-type and add svn:executable using SVN 1.7 syntax", + inputText => <<'END', +Added: svn:mime-type +## -0,0 +1 ## ++image/png +\ No newline at end of property +Added: svn:executable +## -0,0 +1 ## ++* +\ No newline at end of property +END + expectedReturn => [ +{ + name => "svn:mime-type", + propertyChangeDelta => 1, + value => "image/png", +}, +"Added: svn:executable\n"], + expectedNextLine => "## -0,0 +1 ##\n", +}, +#### # Property value followed by empty line and start of next diff ## { diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl index 2de8ae384..33da14abf 100644 --- a/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl +++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl @@ -2,6 +2,7 @@ # # Copyright (C) Research in Motion Limited 2010. All Rights Reserved. # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) +# Copyright (C) 2012 Daniel Bates (dbates@intudata.com) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -211,6 +212,29 @@ END expectedReturn => ["/trunk/Makefile:r33020", " Reverse-merged /trunk/Makefile.shared:r58350\n"], expectedNextLine => " Merged /trunk/ChangeLog:r64190\n", }, +## +# Using SVN 1.7 syntax +## +{ + # New test + diffName => "singe-line '+' change using SVN 1.7 syntax", + inputText => <<'END', ++* +\ No newline at end of property +END + expectedReturn => ["*", "\\ No newline at end of property\n"], + expectedNextLine => undef, +}, +{ + # New test + diffName => "single-line '-' change using SVN 1.7 syntax", + inputText => <<'END', +-* +\ No newline at end of property +END + expectedReturn => ["*", "\\ No newline at end of property\n"], + expectedNextLine => undef, +}, ); my $testCasesCount = @testCaseHashRefs; |
