groovy

Empty case block before default prevents default block from executing

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Duplicate
  • Affects Version/s: 1.1-beta-1
  • Fix Version/s: 1.1-beta-2
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

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.

Activity

Hide
Paul King added a comment -

Duplicate of GROOVY-1949

Show
Paul King added a comment - Duplicate of GROOVY-1949

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: