Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2556

Assignment Operator returns not always the right values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.5.2
    • 1.5.3
    • None
    • None

    Description

      The test case at the bottom runs with 1.5.0 and 1.5.1 and fails with 1.5.2.

      The failing test with 1.5.2 is testAssignmentWithMap

      class AssignmentTest extends GroovyTestCase {
          final String SOME_METHOD_VALUE = 'someMethodValue'
          final String TEST_NAME = 'someName'
      
          String s
      
          Map names
      
          void setUp() {
              names = [:]
          }
          
          void testAssignmentWithString() {
              assertEquals(SOME_METHOD_VALUE, someMethod())
          }
      
          void testAssignmentWithMap() {
              assertEquals(TEST_NAME, addName(TEST_NAME))
          }
      
          String someMethod() {
              s = SOME_METHOD_VALUE
          }
      
          String addName(String name) {
              names[name] = name
          }
      }
      

      Attachments

        Activity

          People

            ait Alex Tkachman
            hans_d Hans Dockter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: