diff --git a/src/test/java/com/rarchives/ripme/tst/UtilsTest.java b/src/test/java/com/rarchives/ripme/tst/UtilsTest.java index 3ffdd7b2..f51a617d 100644 --- a/src/test/java/com/rarchives/ripme/tst/UtilsTest.java +++ b/src/test/java/com/rarchives/ripme/tst/UtilsTest.java @@ -3,6 +3,8 @@ package com.rarchives.ripme.tst; import junit.framework.TestCase; import com.rarchives.ripme.utils.Utils; +import java.io.File; +import java.io.FileNotFoundException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; @@ -44,4 +46,15 @@ public class UtilsTest extends TestCase { assertEquals(Arrays.asList(" is a "), Utils.between("This is a test", "This", "test")); } + public void testShortenFileNameWindows() throws FileNotFoundException { + String filename = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.png"; + // Test filename shortening for windows + File f = Utils.shortenSaveAsWindows("D:/rips/test/reddit/deep", filename ); + assertEquals(new File("D:/rips/test/reddit/deep/fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.png"), f); + } + + public void testSanitizeSaveAs() { + assertEquals("This is a _ !__ test", Utils.sanitizeSaveAs("This is a \" !