Skip to content

Commit

Permalink
add losted files in previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gangz committed Sep 7, 2019
1 parent da8c7d2 commit 890ec77
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
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("\\\\", "/");
}
}
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 src/test/java/depends/format/path/UnixPathFilenameWritterTest.java
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"));
}

}
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"));
}

}

0 comments on commit 890ec77

Please sign in to comment.