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

the equals operator(==) error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.1
    • 1.5.5, 1.6-beta-1
    • XML Processing
    • None
    • groovy 1.5.3

    Description

      the example is :

      def CAR_RECORDS = '''
      <records>
      <car name='HSV Maloo' make='Holden' year='2006'>
      <country>Australia</country>
      <record type='speed'>Production Pickup Truck with speed of 271kph</record>
      </car>
      <car name='P50' make='Peel' year='1962'>
      <country>Isle of Man</country>
      <record type='size'>Smallest Street-Legal Car at 99cm wide and 59 kg in weight</record>
      </car>
      <car name='Royale' make='Bugatti' year='1931'>
      <country>France</country>
      <record type='price'>Most Valuable Car at $15 million</record>
      </car>
      </records>
      '''
      def slurperRoot = new XmlSlurper().parseText(CAR_RECORDS)
      assert slurperRoot.car[1].@name=='P50'//OK
      assert 'P50'==slurperRoot.car[1].@name//ERROR(cast error)

      Attachments

        Activity

          People

            paulk Paul King
            agile Agile Quemuel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: