From: Constantine Plotnikov <constantine.plotnikov@gmail.com>
To: git@vger.kernel.org
Subject: [JGIT PATCH 1/1] Invalid test preventing a build using maven
Date: Mon, 16 Feb 2009 20:46:31 +0300 [thread overview]
Message-ID: <85647ef50902160946m480542a3m1511366f6cafe04e@mail.gmail.com> (raw)
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() {
next reply other threads:[~2009-02-16 17:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-16 17:46 Constantine Plotnikov [this message]
2009-02-16 18:05 ` [JGIT PATCH 1/1] Invalid test preventing a build using maven Sverre Rabbelier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85647ef50902160946m480542a3m1511366f6cafe04e@mail.gmail.com \
--to=constantine.plotnikov@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).