File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,22 @@ class SyntaxErrorsSpec extends AnyFunSuite {
4646 assert(syntaxErrorException.msg.contains(" The field is a leaf element" ))
4747 }
4848
49+ test(" Test handle malformed statement" ) {
50+ val copyBookContents : String =
51+ """ 01 RECORD.
52+ | 07 SUB-FLD1 PIC X(30).
53+ |""" .stripMargin
54+
55+ val syntaxErrorException = intercept[SyntaxErrorException ] {
56+ CopybookParser .parseTree(copyBookContents)
57+ }
58+
59+ assert(syntaxErrorException.lineNumber == 2 )
60+ assert(syntaxErrorException.posOpt.contains(13 ))
61+ assert(syntaxErrorException.fieldOpt.isEmpty)
62+ assert(syntaxErrorException.msg == " Invalid input 'SUB-FLD1' at position 2:13" )
63+ }
64+
4965 test(" Test handle malformed redefines" ) {
5066 val copyBookContents : String =
5167 """ 01 RECORD.
You can’t perform that action at this time.
0 commit comments