Comments (3)
In order to ease tests writing, it should be useful to have only one file to describe tests cases.
In this file you could write the statements to test, if this statement is expected to be parsed correctly and then the expected processed statement.
Ex:
Ok: add a to b -> add a to b *> the test statement and processed statement are identical
Ok: add a to b *> same test as above. In this case the expected statement will be equals to the statement to test
Ko: add to b *> Parsing error expected
OK: add toto titi tata to X -> add toto titi tata to X *> in the processed statement all redundant spaces are trimmed
This kind of test could be written by Cobol developper without knowledge of the TypeCobol parser.
from typecobol.
I think the form given to a specific result file could be given by its name.
For example, corresponding to source cobol file named ADD.cbl
(put in Samples\Statements
folder), could be (in ResultFiles\Statements
folder) :
ADDCodeElements.txt
, containing the CodeElement.ToString() calls as we know itADDRPN.txt
, containing the conversion to Reverse Polish Notation stringsADDNY.txt
, containing just "Y" or "N" depending of the correct (or incorrect) parsing of each line- whatever else we think of
For a given cobol file, the test engine could find all files beginning with ADD
, deciding wich comparison happens by looking at the suffix, and defaulting to CodeElement comparison if it only finds ADD.txt
as a result file.
If no result file is to be found, an error would be thrown.
This solution is more flexible that what we have (even considering today's improvements), but would prevent having for example the files ADD.cbl
and ADDErrors.cbl
in the same folder. We should have ADDSuccesses.cbl
and ADDErrors.cbl
instead.
from typecobol.
Since a few months, test engine automatically test files in subfolders of TypeCobol.Test/Compiler/Parser/Samples
and compare results with expected result files in subfolders of TypeCobol.Test/Compiler/Parser
.
Different comparators can be used, depending of the name of a given result file.
You can create more than one expected result file for a given sample file if you want to run different comparators for the same sample.
Let's say it's enough to close this issue.
Create other issue if additional needs arise.
from typecobol.
Related Issues (20)
- Cobol 6.3: Update XML GENERATE statement
- Cobol 6.3: Update SORT statement
- Update JSON GENERATE/PARSE statements
- Cobol 6.3: add syntax support for DYNAMIC LENGTH items
- Copy parsing: allow to specify context
- Capture file name or table in SORT statement HOT 1
- REDEFINES of REDEFINES with transitivity are not correctly managed HOT 1
- Support new compiler directive VSAMOPENFS from Cobol 5.1 to Cobol 6.3
- IndexOutOfRangeException in Token.SourceText property HOT 2
- NullReferenceException in Workspace.CollectDataLayoutNodes HOT 1
- NullReferenceException when getting DataDefinition.StartPosition property
- Incorrect URI management in notifications PublishDiagnostics and MissingCopies
- Check URI management in Language Server
- Value cannot be null. (Parameter 'source')
- InvalidOperationException in lazy field RedefinedVariable of DataRedefines
- Missing diagnostic on invalid picture/usage combination
- PictureType length may be wrong when picture category is NationalEdited
- Missing compatibility check between Picture and Usage
- NullReference in RedefinesChecker.OnNode(DataRedefines redefinesNode) HOT 1
- Optimize the StartPosition property
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typecobol.