1 17 package org.apache.tools.ant.taskdefs.optional.perforce; 18 19 import junit.framework.TestCase; 20 import org.apache.oro.text.perl.Perl5Util; 21 22 25 public class P4ChangeTest extends TestCase { 26 27 protected P4Change p4change; 28 29 public P4ChangeTest(String s) { 30 super(s); 31 } 32 33 protected void setUp() throws Exception { 34 p4change = new P4Change(); 35 } 36 37 public void testBackslash(){ 38 String input = "comment with a / inside"; 39 String output = p4change.backslash(input); 40 assertEquals("comment with a \\/ inside", output); 41 } 42 43 public void testSubstitute(){ 44 Perl5Util util = new Perl5Util(); 45 String tosubstitute = "xx<here>xx"; 46 String input = p4change.backslash("/a/b/c/"); 47 String output = util.substitute("s/<here>/" + input + "/", tosubstitute); 48 assertEquals("xx/a/b/c/xx", output); 49 } 50 51 } 52 | Popular Tags |