Skip to content

Commit

Permalink
Merge pull request #545 from smeup/feature/LS24002974/except-mock-imp…
Browse files Browse the repository at this point in the history
…lementation

Feature/ls24002974/except mock implementation
  • Loading branch information
lanarimarco authored Jun 12, 2024
2 parents 433e697 + e33ac4f commit ddb39dd
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private val modules = SerializersModule {
subclass(DowStmt::class)
subclass(DOWxxStmt::class)
subclass(EvalStmt::class)
subclass(ExceptStmt::class)
subclass(ExecuteSubroutine::class)
subclass(ExfmtStmt::class)
subclass(FeodStmt::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2410,6 +2410,19 @@ data class UnlockStmt(
override fun execute(interpreter: InterpreterCore) {}
}

@Serializable
data class ExceptStmt(
override val position: Position? = null
) : Statement(position) {
override val loggableEntityName: String
get() = "EXCEPT"

override fun execute(interpreter: InterpreterCore) {
// TODO: Replace with actual implementation
throw NotImplementedError("EXCEPT statement is not implemented yet")
}
}

@Serializable
data class FeodStmt(
override val position: Position? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,9 @@ internal fun Cspec_fixed_standardContext.toAst(conf: ToAstConfiguration = ToAstC
this.csUNLOCK() != null -> this.csUNLOCK()
.let { it.cspec_fixed_standard_parts().validate(stmt = it.toAst(conf), conf = conf) }

this.csEXCEPT() != null -> this.csEXCEPT()
.let { it.cspec_fixed_standard_parts().validate(stmt = it.toAst(conf), conf = conf) }

this.csFEOD() != null -> this.csFEOD()
.let { it.cspec_fixed_standard_parts().validate(stmt = it.toAst(conf), conf = conf) }

Expand Down Expand Up @@ -2093,6 +2096,12 @@ internal fun CsUNLOCKContext.toAst(conf: ToAstConfiguration = ToAstConfiguration
return UnlockStmt(position)
}

// TODO
internal fun CsEXCEPTContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): Statement {
val position = toPosition(conf.considerPosition)
return ExceptStmt(position)
}

internal fun CsTESTNContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): TestnStmt {
val position = toPosition(conf.considerPosition)
val resultExpression = this.cspec_fixed_standard_parts().resultExpression(conf) as AssignableExpression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,14 @@ open class MULANGT10BaseCodopTest : MULANGTTest() {
val expected = listOf("51=1,52=0,53=0")
assertEquals(expected, "smeup/MU102501".outputOf())
}

/**
* EXCEPT statement is supported
* @see #LS24002974
*/
@Test
fun executeMUDRNRAPU00216() {
val expected = listOf("ok")
assertEquals(expected, "smeup/MUDRNRAPU00216".outputOf())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
D £DBG_Str S 2
C IF 0
C EXCEPT E1RIGA
C ENDIF
C EVAL £DBG_Str='ok'
C £DBG_Str DSPLY

0 comments on commit ddb39dd

Please sign in to comment.