Skip to content

Commit

Permalink
[JENKINS-18014] unit test to reproduce issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeloof committed Jun 11, 2013
1 parent b29b7ff commit 46b3d2c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/java/org/jenkinsci/plugins/tokenmacro/TokenMacroTest.java
Expand Up @@ -6,6 +6,7 @@
import hudson.model.FreeStyleProject;
import hudson.model.TaskListener;
import hudson.util.StreamTaskListener;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TestExtension;

Expand Down Expand Up @@ -78,6 +79,18 @@ public void testEscaped() throws Exception {
assertEquals("{abc=[def, ghi], jkl=[true]}\\${TEST_NESTED}",TokenMacro.expand(b,listener,"$TEST_NESTED\\${TEST_NESTED}"));
}

@Bug(18014)
public void testEscapeCharEscaped() throws Exception {
FreeStyleProject p = createFreeStyleProject("foo");
FreeStyleBuild b = p.scheduleBuild2(0).get();

listener = new StreamTaskListener(System.out);
assertEquals("\\{abc=[def, ghi], jkl=[true]}",TokenMacro.expand(b,listener,"\\\\${TEST_NESTED}"));
assertEquals("\\{abc=[def, ghi], jkl=[true]}",TokenMacro.expand(b,listener,"\\\\$TEST_NESTED"));
assertEquals("{abc=[def, ghi], jkl=[true]}\\{abc=[def, ghi], jkl=[true]}",TokenMacro.expand(b,listener,"$TEST_NESTED\\\\$TEST_NESTED"));
assertEquals("{abc=[def, ghi], jkl=[true]}\\{abc=[def, ghi], jkl=[true]}",TokenMacro.expand(b,listener,"$TEST_NESTED\\\\${TEST_NESTED}"));
}

public void testPrivate() throws Exception {
List<TokenMacro> privateMacros = new ArrayList<TokenMacro>();
privateMacros.add(new PrivateTestMacro());
Expand Down

0 comments on commit 46b3d2c

Please sign in to comment.