[JIRA] (JENKINS-59911) Result of assignment expression is null rather than assigned value

6 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Oct 25, 2019, 5:19:02 PM10/25/19
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Jenkins / Bug JENKINS-59911
Result of assignment expression is null rather than assigned value
Change By: Jesse Glick
Summary: Different behavior for groovy in pipeline and script console Result of assignment expression is null rather than assigned value
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

sparshev@griddynamics.com (JIRA)

unread,
Oct 25, 2019, 5:25:03 PM10/25/19
to jenkinsc...@googlegroups.com
Sergei Parshev commented on Bug JENKINS-59911
 
Re: Result of assignment expression is null rather than assigned value

Oh, I thought it's just a "feature" in realization like "don't use `.each`" and stuff... Ok, good to know, thank you)

sparshev@griddynamics.com (JIRA)

unread,
Nov 7, 2019, 6:34:02 PM11/7/19
to jenkinsc...@googlegroups.com
Sergei Parshev edited a comment on Bug JENKINS-59911
Yeah, I added additional a test to groovy-cps:
{code
:java }
@Test
void justatest() {
    assert evalCPS('''
        def a = 3;
        def b = 4;
        a = b = 6;
        return "${a}, ${b}";
    ''')=="6, 6";
}
{code}
and it's failed:
{noformat}
[ERROR] Failures:
[ERROR]   CpsTransformerTest.justatest:50->AbstractGroovyCpsTest.evalCPS:50 assert resultInCps==sh.evaluate(script)
       |          | |  |        |
       null, 6    | |  6, 6
                  | |                     def a = 3;
                  | |                     def b = 4;
                  | |                     a = b = 6;
                  | |                     return "${a}, ${b}";
                  | |
                  | groovy.lang.GroovyShell@6ae42248
                  false
{noformat}

sparshev@griddynamics.com (JIRA)

unread,
Nov 7, 2019, 6:34:03 PM11/7/19
to jenkinsc...@googlegroups.com

Yeah, I added additional test to groovy-cps:

@Test
void justatest() {
    assert evalCPS('''
        def a = 3;
        def b = 4;
        a = b = 6;
        return "${a}, ${b}";
    ''')=="6, 6";
}

and it's failed:

[ERROR] Failures:
[ERROR]   CpsTransformerTest.justatest:50->AbstractGroovyCpsTest.evalCPS:50 assert resultInCps==sh.evaluate(script)
       |          | |  |        |
       null, 6    | |  6, 6
                  | |                       def a = 3;
                  | |                       def b = 4;
                  | |                       a = b = 6;
                  | |                       return "${a}, ${b}";
                  | |
                  | groovy.lang.GroovyShell@6ae42248
                  false
Reply all
Reply to author
Forward
0 new messages