git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 1/1] Invalid test preventing a build using maven
@ 2009-02-16 17:46 Constantine Plotnikov
  2009-02-16 18:05 ` Sverre Rabbelier
  0 siblings, 1 reply; 2+ messages in thread
From: Constantine Plotnikov @ 2009-02-16 17:46 UTC (permalink / raw)
  To: git

I have tried to build jgit using maven on Windows and build failed due
to the failed test. The test
QuotedStringGitPathStyleTest.testDequote_OctalAll was dependent on the
system charset. If the test is run with -Dfile.encoding=Cp1251 under
eclipse, it failed as well.

This was cased that by the fact that corresponding test generated
invalid UTF-8 character sequence for code points U+80 - U+FF. In that
case the method RawParseUtils.decodeNoFallback fall backs to the
default system encoding that is Cp1251 in my environment.

The attached patch ensures that correct UTF-8 character sequence is
used in the test.

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java
b/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java
index 54fbd31..7d29f21 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java
@@ -127,13 +127,22 @@ public void testDequote_NamedEscapes() {
 	}

 	public void testDequote_OctalAll() {
-		for (int i = 0; i < 256; i++) {
-			String s = Integer.toOctalString(i);
-			while (s.length() < 3) {
-				s = "0" + s;
-			}
-			assertDequote("" + (char) i, "\\" + s);
+		for (int i = 0; i < 127; i++) {
+			assertDequote("" + (char) i, octalEscape(i));
 		}
+		for (int i = 128; i < 256; i++) {
+			int f = 0xC0 | (i >> 6);
+			int s = 0x80 | (i & 0x3f);
+			assertDequote("" + (char) i, octalEscape(f)+octalEscape(s));
+		}
+	}
+
+	private String octalEscape(int i) {
+		String s = Integer.toOctalString(i);
+		while (s.length() < 3) {
+			s = "0" + s;
+		}
+		return "\\"+s;
 	}

 	public void testQuote_OctalAll() {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [JGIT PATCH 1/1] Invalid test preventing a build using maven
  2009-02-16 17:46 [JGIT PATCH 1/1] Invalid test preventing a build using maven Constantine Plotnikov
@ 2009-02-16 18:05 ` Sverre Rabbelier
  0 siblings, 0 replies; 2+ messages in thread
From: Sverre Rabbelier @ 2009-02-16 18:05 UTC (permalink / raw)
  To: Constantine Plotnikov; +Cc: git

Heya,

On Mon, Feb 16, 2009 at 18:46, Constantine Plotnikov
<constantine.plotnikov@gmail.com> wrote:
> The attached patch ensures that correct UTF-8 character sequence is
> used in the test.

Please follow the guidelines to submitting patches as described in
Documentation/SubmittingPatches (available online at [0]). Doing so
will save the maintainer (in this case Shawn) the time required to
munge your patch into an applyable format. Also, your commit message
is funny in the sense that part of it should go into the actual commit
message, and part of it should go after the triple dashes (also
described in SubmittingPatches).

Good luck :).

[0] http://repo.or.cz/w/git.git?a=blob_plain;f=Documentation/SubmittingPatches;hb=HEAD

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-16 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-16 17:46 [JGIT PATCH 1/1] Invalid test preventing a build using maven Constantine Plotnikov
2009-02-16 18:05 ` Sverre Rabbelier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).