TypeCobol is an Incremental Cobol parser for IBM Enterprise Cobol 6 for zOS syntax. TypeCobol is also an extension of Cobol 85 language which can then be converted to Cobol85.
LSR testing is cumbersome and refactoring needs more tests as it is complex to create edits on COBOL source.
The goal of this issue is to design and implement a new kind of tests specifically for our COBOL refactorings.
Ideas:
A refactoring test is made of 3 parts:
A target source code on which the refactoring must be applied
The description of a command (name + args)
The expected source code after refactoring has been applied
Workflow of a test:
Parse test file, that means identify all 3 parts
Load and parse the target source code
Gather info to launch the command on the previously built AST
Apply modifications on source code, here we'll have to convert TextEdits into RangeUpdates
Read modified source code as text
Compare expected source code text with actual source code text
Technical considerations:
The method ParserUtils.ParseCobolString can be used to parse a chunk of text, however it must be extended to allow caller to specify the ColumnsLayout (and maybe other options if need be)
Before testing refactoring independently from the server and the protocol, we need to create an abstraction for refactorings server side. In our current implementation commands directly compute edits and are tied to the TypeCobolServer object in order to retrieve the CompilationUnit being worked on and send request to client containing edits
A Refactoring may be seen as a specialization of a Command operating on a list of documents identified by their Uris and depending on a RefactoringProcessor to produce the TextEdits.
In this model, the RefactoringProcessor class and its inheritors will be the elements being tested and therefore will have to be independent from the server.
LSR testing is cumbersome and refactoring needs more tests as it is complex to create edits on COBOL source. The goal of this issue is to design and implement a new kind of tests specifically for our COBOL refactorings.
Ideas:
Workflow of a test:
TextEdit
s intoRangeUpdate
sTechnical considerations:
ParserUtils.ParseCobolString
can be used to parse a chunk of text, however it must be extended to allow caller to specify theColumnsLayout
(and maybe other options if need be)TypeCobolServer
object in order to retrieve theCompilationUnit
being worked on and send request to client containing editsRefactoring
may be seen as a specialization of aCommand
operating on a list of documents identified by theirUri
s and depending on aRefactoringProcessor
to produce theTextEdits
.RefactoringProcessor
class and its inheritors will be the elements being tested and therefore will have to be independent from the server.