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

Problem With Stacked Cases In Switch Statements

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1-beta-1
    • 1.1-beta-2
    • None
    • None
    • groovy console 1.1 beta

    Description

      MARC PALMER REPORTS:
      --------------------------------------
      Hi,

      I found this funny behaviour yesterday, want to confirm it is incorrect behaviour before JIRA'ing.

      Exhibit A, run in groovy console 1.1 beta:

      def getServerURL(env) { 
              def serverURL 
              switch (env) { 
                      case "remoteTestAnyware" : 
                              serverURL = "http://mail.anyware.co.uk:999" 
                              break; 
                      case "testSeb" : 
                              serverURL = "http://192.168.1.64:8080" 
                              break; 
                      case "testEnotions" : 
                      default: 
                              serverURL = "http://localhost:8080" 
                              break; 
              } 
              return serverURL 
      } 
      
      assert getServerURL('remoteTestAnyware') == "http://mail.anyware.co.uk:999"
      assert getServerURL('development') == "http://localhost:8080" 
      

      Attachments

        Activity

          People

            paulk Paul King
            vbuskirk Chris vanBuskirk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: