File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -56,11 +56,25 @@ Sleep-seconds: 2'''
56
56
env. COMMIT_MESSAGE = ' A commit message with a "double quote"'
57
57
// just make sure this doesn't trip an error due to the double
58
58
// quotes
59
- println (commitPragmaTrusted(pragma : ' Foo-bar: ' ,
59
+ assert (commitPragmaTrusted(pragma : ' Foo-bar' ,
60
60
def_val : ' 1' ) == " 1" )
61
61
}
62
62
} // steps
63
63
} // stage ('env.COMMIT_MESSAGE pragma test')
64
+ stage (' env.COMMIT_MESSAGE case insensitivity test' ) {
65
+ steps {
66
+ script {
67
+ env. COMMIT_MESSAGE = ''' A commit message
68
+
69
+ Set in env.COMMIT_MESSAGE
70
+
71
+ Sleep-seconds: 2'''
72
+ // just make sure this doesn't trip an error due to the double
73
+ // quotes
74
+ assert(commitPragmaTrusted(' sleep-seconds' , ' 1' ) == " 2" )
75
+ }
76
+ } // steps
77
+ } // stage ('env.COMMIT_MESSAGE pragma test')
64
78
} // stage ('Test')
65
79
post {
66
80
success {
Original file line number Diff line number Diff line change 10
10
* config['def_val'] Value to return if not found
11
11
*/
12
12
def call (Map config = [:]) {
13
+ // convert the map for compat
14
+ return commitPragmaTrusted(config[' pragma' ], config[' def_val' ])
15
+ }
16
+
17
+ def call (String name , String def_val = null ) {
18
+ /**
19
+ * @param name Pragma to get the value of
20
+ * @param def_val Value to return if not found
21
+ */
13
22
14
23
def def_value = ' '
15
- if (config[ ' def_val' ] ) {
16
- def_value = config[ ' def_val' ]
24
+ if (def_val) {
25
+ def_value = def_val
17
26
}
18
27
19
28
String commit_message= " "
@@ -36,8 +45,8 @@ def call(Map config = [:]) {
36
45
returnStdout : true ). trim()
37
46
}
38
47
return sh(script : ' b=$(echo "' + commit_message. replaceAll(' "' , ' \\\\ "' ) +
39
- ''' " | sed -ne 's/^''' + config[ ' pragma ' ] +
40
- ''' : *\\ (.*\\ )/\\ 1/p ')
48
+ ''' " | sed -ne 's/^''' + name +
49
+ ''' : *\\ (.*\\ )/\\ 1/Ip ')
41
50
if [ -n "$b" ]; then
42
51
echo "$b"
43
52
else
You can’t perform that action at this time.
0 commit comments