groovy

unit test case to ensure that we always set line number information on all AST nodes

Details

  • Type: Wish Wish
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.5.6, 1.6-beta-1
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

It'd be great if we could write a test where we parse a large blob of groovy code with all kinds of different expressions & statements and ensured that every AST node has real line numbers associated with it (i.e. not -1)

Issue Links

Activity

Hide
Zohar Melamed added a comment -

requires adding a test as described in groovy-259

Show
Zohar Melamed added a comment - requires adding a test as described in groovy-259
Hide
Guillaume Laforge added a comment -

Since you worked on that recently, you can potentially update the status of that task if required.

Show
Guillaume Laforge added a comment - Since you worked on that recently, you can potentially update the status of that task if required.
Hide
Martin Kempf added a comment -

Description of Patch
------------------------------
The patch provides a test environment to verify the line/column information of the AST. The following lines describe the possibilities of the environment:

The test file specifies the nodes which the AST should contain. It is defined as follows:

###<testname>:::
<source code from which the AST will be built>
:::<expected AST output>

The section above can be repeated for every new TestCase

The AST output from the visitor is quite big. Also for small source code snippets. Therefore
it is possible to only specify the nodes that you wan't to check and separate them with a semicolon.
A semicolon is also needed when you begin with a new line.
Bsp:
[TryCatchStatement,(1:1),(9:2)][BlockStatement,(1:5),(3:3)];
[CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)];
[CatchStatement,(5:3),(7:3)][BlockStatement,(5:12),(7:3)];
[BlockStatement,(7:3),(9:2)][BlockStatement,(7:11),(9:2)]

[<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]

Show
Martin Kempf added a comment - Description of Patch ------------------------------ The patch provides a test environment to verify the line/column information of the AST. The following lines describe the possibilities of the environment: The test file specifies the nodes which the AST should contain. It is defined as follows: ###<testname>::: <source code from which the AST will be built> :::<expected AST output> The section above can be repeated for every new TestCase The AST output from the visitor is quite big. Also for small source code snippets. Therefore it is possible to only specify the nodes that you wan't to check and separate them with a semicolon. A semicolon is also needed when you begin with a new line. Bsp: [TryCatchStatement,(1:1),(9:2)][BlockStatement,(1:5),(3:3)]; [CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)]; [CatchStatement,(5:3),(7:3)][BlockStatement,(5:12),(7:3)]; [BlockStatement,(7:3),(9:2)][BlockStatement,(7:11),(9:2)] [<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]

People

Vote (2)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: