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

Empty case block before default prevents default block from executing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 1.1-beta-1
    • 1.1-beta-2
    • None
    • None

    Description

      Example where second assert fails in Groovy console 1.1-beta1:

      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"
      

      If the empty "testEnotions" case is removed, the assert works.

      Attachments

        Activity

          People

            paulk Paul King
            marc@anyware.co.uk Marc Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: