Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringBourneStyleTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringBourneStyleTest.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringBourneStyleTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringBourneStyleTest.java
index b9a721a464..65078763e7 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringBourneStyleTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringBourneStyleTest.java
@@ -44,11 +44,14 @@
package org.eclipse.jgit.util;
import static org.eclipse.jgit.util.QuotedString.BOURNE;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
import org.eclipse.jgit.lib.Constants;
+import org.junit.Test;
-public class QuotedStringBourneStyleTest extends TestCase {
+public class QuotedStringBourneStyleTest {
private static void assertQuote(final String in, final String exp) {
final String r = BOURNE.quote(in);
assertNotSame(in, r);
@@ -62,32 +65,39 @@ public class QuotedStringBourneStyleTest extends TestCase {
assertEquals(exp, r);
}
+ @Test
public void testQuote_Empty() {
assertEquals("''", BOURNE.quote(""));
}
+ @Test
public void testDequote_Empty1() {
assertEquals("", BOURNE.dequote(new byte[0], 0, 0));
}
+ @Test
public void testDequote_Empty2() {
assertEquals("", BOURNE.dequote(new byte[] { '\'', '\'' }, 0, 2));
}
+ @Test
public void testDequote_SoleSq() {
assertEquals("", BOURNE.dequote(new byte[] { '\'' }, 0, 1));
}
+ @Test
public void testQuote_BareA() {
assertQuote("a", "a");
}
+ @Test
public void testDequote_BareA() {
final String in = "a";
final byte[] b = Constants.encode(in);
assertEquals(in, BOURNE.dequote(b, 0, b.length));
}
+ @Test
public void testDequote_BareABCZ_OnlyBC() {
final String in = "abcz";
final byte[] b = Constants.encode(in);
@@ -95,10 +105,12 @@ public class QuotedStringBourneStyleTest extends TestCase {
assertEquals("bc", BOURNE.dequote(b, p, p + 2));
}
+ @Test
public void testDequote_LoneBackslash() {
assertDequote("\\", "\\");
}
+ @Test
public void testQuote_NamedEscapes() {
assertQuote("'", "'\\''");
assertQuote("!", "'\\!'");
@@ -107,6 +119,7 @@ public class QuotedStringBourneStyleTest extends TestCase {
assertQuote("a!b", "a'\\!'b");
}
+ @Test
public void testDequote_NamedEscapes() {
assertDequote("'", "'\\''");
assertDequote("!", "'\\!'");

Back to the top