You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2017/11/16 12:20:48 UTC
commons-io git commit: Test if arrays are sorted
Repository: commons-io
Updated Branches:
refs/heads/master b014a06d5 -> dcf6e82f8
Test if arrays are sorted
Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/dcf6e82f
Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/dcf6e82f
Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/dcf6e82f
Branch: refs/heads/master
Commit: dcf6e82f8610b89075e00711e186792053928c7e
Parents: b014a06
Author: Sebb <se...@apache.org>
Authored: Thu Nov 16 12:20:32 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Thu Nov 16 12:20:32 2017 +0000
----------------------------------------------------------------------
.../org/apache/commons/io/FileSystemTestCase.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-io/blob/dcf6e82f/src/test/java/org/apache/commons/io/FileSystemTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/io/FileSystemTestCase.java b/src/test/java/org/apache/commons/io/FileSystemTestCase.java
index e62eace..84dc3c3 100644
--- a/src/test/java/org/apache/commons/io/FileSystemTestCase.java
+++ b/src/test/java/org/apache/commons/io/FileSystemTestCase.java
@@ -17,14 +17,22 @@
package org.apache.commons.io;
-import java.util.Arrays;
-
import org.junit.Assert;
import org.junit.Test;
public class FileSystemTestCase {
@Test
+ public void testSorted() {
+ for (FileSystem fs : FileSystem.values()) {
+ char[] chars=fs.getIllegalFileNameChars();
+ for (int i=0; i < chars.length - 1; i++) {
+ Assert.assertTrue(fs.name(), chars[i] < chars[i+1]);
+ }
+ }
+ }
+
+ @Test
public void testToLegalFileNameWindows() {
FileSystem fs = FileSystem.WINDOWS;
char replacement = '-';
@@ -32,8 +40,6 @@ public class FileSystemTestCase {
Assert.assertEquals(replacement, fs.toLegalFileName(String.valueOf(i), replacement).charAt(0));
}
char[] illegal = new char[] { '<', '>', ':', '"', '/', '\\', '|', '?', '*' };
- Arrays.sort(illegal);
- System.out.println(Arrays.toString(illegal));
for (char i = 0; i < illegal.length; i++) {
Assert.assertEquals(replacement, fs.toLegalFileName(String.valueOf(i), replacement).charAt(0));
}