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

Assert a closure call should look like

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.4, 1.8-beta-1
    • 1.7.5, 1.8-beta-2
    • None
    • None

    Description

      As per the following conversation:

      http://groovy.markmail.org/search/?q=Power%20assert%20question%20when%20asserting%20closure%20calls#query:Power%20assert%20question%20when%20asserting%20closure%20calls+page:1+mid:bzbavvzceem3dd2z+state:results

      We should make closure calls look like method calls.

      So for:

      def closure = { it }
      assert closure(false)
      

      instead of:

      assert closure(false)
             |
             ConsoleScript1$_run_closure1@575fa5
      

      we should get:

      assert closure(false)
             |
             false
      

      If one really wans to see the toString() of the closure, he could still do:

      assert closure.call(false)
             |       |
             |       false
             ConsoleScript2$_run_closure1@f1584a
      

      Attachments

        Activity

          People

            pniederw Peter Niederwieser
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: