Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/NW23001440/movea_with_IN
Browse files Browse the repository at this point in the history
  • Loading branch information
cosentino-smeup committed Jan 17, 2024
2 parents c37844f + 85034b3 commit 0b5fe4d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ internal fun RpgParser.LiteralContext.toAst(conf: ToAstConfiguration = ToAstConf
children[n] = "'"
*/
val stringContent = if (this.children.size > 3) {
this.children.asSequence().filter { it.text != "'" }.joinToString(separator = "")
if (children[0].text == "'" && children[this.children.size - 1].text == "'") {
this.children.subList(1, this.children.size - 1).joinToString(separator = "")
} else {
this.content?.text ?: ""
}
} else {
this.content?.text ?: ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ open class SmeupInterpreterTest : AbstractTest() {
assertEquals(expected, "smeup/T40_A10_P07".outputOf())
}

@Test
fun executeT02_S10_P01() {
val expected = listOf(
"abcdefghijklmnopqrstuvwxyzèéàòùABCDEFGHIJKLMNOPQRS TUVWXYZEEAOUABCDEFGHIJKLMNOPQRSTUVWXYZEEAOUABCDEFGHIJKLMNOPQRSTUVWXYZEEAOUABCDEFGHIJKLMNOPQRSTUVWXYZEEAOUABCDEFGH'''*%"
)
assertEquals(expected, "smeup/T02_S10_P01".outputOf())
}

@Test
fun executeT40_A10_P03D() {
val expected = listOf(
Expand Down
33 changes: 33 additions & 0 deletions rpgJavaInterpreter-core/src/test/resources/smeup/T02_S10_P01.rpgle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
D A10_A1 C 'abcdefghijklmnopqrs-
D tuvwxyzèéàòù'
D A10_A2 C 'ABCDEFGHIJKLMNOPQRS-
D TUVWXYZEEAOU'
D A10_A3 C 'ABCDEFGHIJKLMNOPQRS+
D TUVWXYZEEAOU'
D A10_A4 C 'ABCDEFGHIJKLMNOPQRS+
D TUVWXYZEEAOU'
D A10_A5 C 'ABCDEFGHIJKLMNOPQRSTUVWXYZEEAOU'
D A10_A6 C CONST('ABCDEFGH')
D A10_A7 C ''''
D A10_A8 C ''''''
D A10_A9 C '*%'
*
D £DBG_Str S 180
*
C EVAL £DBG_Str=A10_A1+A10_A2+A10_A3
C +A10_A4+A10_A5+A10_A6
C +A10_A7+A10_A8+A10_A9
C £DBG_Str DSPLY
*
* Expected:
* abcdefghijklmnopqrstuvwxyzèéàòùABCDEFGHIJKLMNOPQRS TU
* VWXYZEEAOUABCDEFGHIJKLMNOPQRSTUVWXYZEEAOUABCDEFGHIJKLMNOPQRS
* TUVWXYZEEAOUABCDEFGHIJKLMNOPQRSTUVWXYZEEAOUABCDEFGH'''*%
*
* Note:
* A10_A7: should contain 1 quotation mark: '
* A10_A8: should contain 2 quotation marks: ''
*
*
C SETON LR
*

0 comments on commit 0b5fe4d

Please sign in to comment.