mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-15 21:12:15 +00:00
[FIXED JENKINS-16660] Allow variable names with dots in bracketed references.
Given these <variable,value> mappings: <A,a> and <A.B,a-b>, $A.B would
evaluate to $a.B, as it currently does, and ${A.B} to a-b instead of the
current ${A.B}.
Existing ${A.B}-like references will break (not evaluate to ${A.B}) if
there actually is an A.B variable defined, which I think is very
unlikely.
This commit is contained in:
1 parent
ba432da2b5
commit
3376cf0158
2 files changed
+7
-2
No files matched your search
@@ -50,6 +50,7 @@ public class UtilTest {
|
||||
public void testReplaceMacro() {
|
||||
Map<String,String> m = new HashMap<String,String>();
|
||||
m.put("A","a");
|
||||
m.put("A.B","a-b");
|
||||
m.put("AA","aa");
|
||||
m.put("B","B");
|
||||
m.put("DOLLAR", "$");
|
||||
@@ -68,6 +69,10 @@ public class UtilTest {
|
||||
assertEquals("asd$${AA}dd", Util.replaceMacro("asd$$$${AA}dd",m));
|
||||
assertEquals("$", Util.replaceMacro("$$",m));
|
||||
assertEquals("$$", Util.replaceMacro("$$$$",m));
|
||||
|
||||
// dots
|
||||
assertEquals("a.B", Util.replaceMacro("$A.B", m));
|
||||
assertEquals("a-b", Util.replaceMacro("${A.B}", m));
|
||||
|
||||
// test that more complex scenarios work
|
||||
assertEquals("/a/B/aa", Util.replaceMacro("/$A/$B/$AA",m));
|
||||
|
||||
Reference in new issue
Block a user