-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8360411: [TEST] open/test/jdk/java/io/File/MaxPathLength.java Refactor extract method to encapsulate Windows specific test logic #26193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
|
@@ -60,14 +60,7 @@ public static void main(String[] args) throws Exception { | |
|
||
// test long paths on windows | ||
// And these long pathes cannot be handled on Solaris and Mac platforms | ||
if (isWindows) { | ||
String name = fileName; | ||
while (name.length() < MAX_LENGTH) { | ||
testLongPath (20, name, false); | ||
testLongPath (20, name, true); | ||
name = getNextName(name); | ||
} | ||
} | ||
testLongPathOnWindows(); | ||
} | ||
|
||
private static String getNextName(String fName) { | ||
|
@@ -199,4 +192,15 @@ static void testLongPath(int max, String fn, | |
} | ||
} | ||
} | ||
|
||
private static void testLongPathOnWindows () throws Exception { | ||
if (isWindows) { | ||
String name = fileName; | ||
while (name.length() < MAX_LENGTH) { | ||
testLongPath (20, name, false); | ||
testLongPath (20, name, true); | ||
name = getNextName(name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name doesn't seem to be used after. Do you think it might be beneficial to add an assert here to check if the result is the same as expected ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it would be beneficial. Would this be a valid assert to add after those while loops?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After a second look, I can see that the |
||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: do you think there is a need for a space before the
(
? Looks odd imo. But as the whole file uses this, I'm fine with you leaving this as isThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, was just being coherent