Skip to content

Commit e5f5eac

Browse files
committed
2 parents ef0fb79 + 0cbb22d commit e5f5eac

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,46 @@ public void testGetFreeSpaceWindows_String_ParseCommaFormatBytes() throws Except
179179
assertEquals(41411551232L, fsu.freeSpaceWindows("", -1));
180180
}
181181

182+
//-----------------------------------------------------------------------
183+
@Test
184+
public void testGetFreeSpaceWindows_String_ParseCommaFormatBytes_Big() throws Exception {
185+
// test with very large free space
186+
final String lines =
187+
" Volume in drive C is HDD\n" +
188+
" Volume Serial Number is XXXX-YYYY\n" +
189+
"\n" +
190+
" Directory of C:\\Documents and Settings\\Xxxx\n" +
191+
"\n" +
192+
"19/08/2005 22:43 <DIR> .\n" +
193+
"19/08/2005 22:43 <DIR> ..\n" +
194+
"11/08/2005 01:07 81 build.properties\n" +
195+
"17/08/2005 21:44 <DIR> Desktop\n" +
196+
" 7 File(s) 180,260 bytes\n" +
197+
" 10 Dir(s) 141,411,551,232 bytes free";
198+
final FileSystemUtils fsu = new MockFileSystemUtils(0, lines);
199+
assertEquals(141411551232L, fsu.freeSpaceWindows("", -1));
200+
}
201+
202+
//-----------------------------------------------------------------------
203+
@Test
204+
public void testGetFreeSpaceWindows_String_ParseCommaFormatBytes_Small() throws Exception {
205+
// test with very large free space
206+
final String lines =
207+
" Volume in drive C is HDD\n" +
208+
" Volume Serial Number is XXXX-YYYY\n" +
209+
"\n" +
210+
" Directory of C:\\Documents and Settings\\Xxxx\n" +
211+
"\n" +
212+
"19/08/2005 22:43 <DIR> .\n" +
213+
"19/08/2005 22:43 <DIR> ..\n" +
214+
"11/08/2005 01:07 81 build.properties\n" +
215+
"17/08/2005 21:44 <DIR> Desktop\n" +
216+
" 7 File(s) 180,260 bytes\n" +
217+
" 10 Dir(s) 1,232 bytes free";
218+
final FileSystemUtils fsu = new MockFileSystemUtils(0, lines);
219+
assertEquals(1232L, fsu.freeSpaceWindows("", -1));
220+
}
221+
182222
//-----------------------------------------------------------------------
183223
@Test
184224
public void testGetFreeSpaceWindows_String_EmptyPath() throws Exception {

0 commit comments

Comments
 (0)