forked from HACeng/depends
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/main/java/depends/format/path/UnixPathFilenameWritter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package depends.format.path; | ||
|
||
public class UnixPathFilenameWritter implements FilenameWritter{ | ||
@Override | ||
public String reWrite(String originalPath) { | ||
return originalPath.replaceAll("\\\\", "/"); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/depends/format/path/WindowsPathFilenameWritter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package depends.format.path; | ||
|
||
public class WindowsPathFilenameWritter implements FilenameWritter{ | ||
@Override | ||
public String reWrite(String originalPath) { | ||
return originalPath.replaceAll("/","\\\\"); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/java/depends/format/path/UnixPathFilenameWritterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package depends.format.path; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Test; | ||
|
||
public class UnixPathFilenameWritterTest { | ||
|
||
@Test | ||
public void testRewriteFilename() { | ||
UnixPathFilenameWritter r = new UnixPathFilenameWritter(); | ||
assertEquals("/abc/123.cpp",r.reWrite("/abc/123.cpp")); | ||
assertEquals("/abc/123.cpp",r.reWrite("\\abc\\123.cpp")); | ||
assertEquals("abc/123.cpp",r.reWrite("abc/123.cpp")); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/test/java/depends/format/path/WindowsPathFilenameWritterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package depends.format.path; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Test; | ||
|
||
public class WindowsPathFilenameWritterTest { | ||
|
||
@Test | ||
public void testRewriteFilename() { | ||
WindowsPathFilenameWritter r = new WindowsPathFilenameWritter(); | ||
assertEquals("\\abc\\123.cpp",r.reWrite("/abc/123.cpp")); | ||
assertEquals("\\abc\\123.cpp",r.reWrite("\\abc\\123.cpp")); | ||
} | ||
|
||
} |