@@ -59,6 +59,28 @@ class TestCopybookReplacePatterns {
59
59
+ "8 PROCEDURE DIVISION.\n "
60
60
+ "9 MOVE 0 TO {$TAG_BY-IDS}." ;
61
61
62
+ private static final String TEXT5 =
63
+ BASE
64
+ + " 01 {$*LOGA}. \r \n "
65
+ + " COPY {~REPL5} \r \n "
66
+ + " REPLACING ==LDAY== BY ==DMAN123000000000000000000000000000000005900\n "
67
+ + " - 0000000000000000011111111111111111111111111111111111111111111\n "
68
+ + " - 00000000000000000000000== .\r \n " ;
69
+
70
+ private static final String TEXT6 =
71
+ BASE
72
+ + "5 COPY {~REPL6} REPLACING ==:TAG:== BY == A ==.\r \n "
73
+ + "8 PROCEDURE DIVISION.\r \n "
74
+ + "9 MOVE 0 TO {$A_ID}." ;
75
+
76
+ private static final String TEXT7 =
77
+ BASE
78
+ + " 01 {$*LOGA}. \r \n "
79
+ + " COPY {~REPL7} \r \n "
80
+ + " REPLACING ==LDAY== BY ==DMAN123000000000000000000000000000000005900\n "
81
+ + " - 0000000000000000011111111111111111111111111111111111111111111\n "
82
+ + " - 00000000000000000000000== .\r \n " ;
83
+
62
84
private static final String REPL = "0 01 {$*TAG_ID} PIC 9.\n " ;
63
85
private static final String REPL_NAME = "REPL" ;
64
86
@@ -71,6 +93,22 @@ class TestCopybookReplacePatterns {
71
93
private static final String REPL4 = "0 01 {$*TAG_ID^TAG_BY-IDS} PIC 9.\n " ;
72
94
private static final String REPL4_NAME = "REPL4" ;
73
95
96
+ private static final String REPL5 =
97
+ " ***************************************************************** 09700000\r \n "
98
+ + " 02 {$*LOGHDR}. 18000000\r \n "
99
+ + " 03 {$*LDAY^DMAN1230000000000000000000000000000000000000000000001111111111111111111111111111111111111111111100000000000000000000000} PIC S9(7) COMP-3. 24000000" ;
100
+ private static final String REPL5_NAME = "REPL5" ;
101
+
102
+ private static final String REPL6 =
103
+ "0 01 {$*:TAG:_ID^A_ID} PIC 9. 00007100" ;
104
+ private static final String REPL6_NAME = "REPL6" ;
105
+
106
+ private static final String REPL7 =
107
+ " ***************************************************************** 09700000\r \n "
108
+ + " 02 {$*LOGHDR}. 18000000\r \n "
109
+ + " 03 {$*LDAY^DMAN1230000000000000000000000000000000000000000000001111111111111111111111111111111111111111111100000000000000000000000} PIC S9(7) COMP-3." ;
110
+ private static final String REPL7_NAME = "REPL7" ;
111
+
74
112
@ Test
75
113
void testPartialTextAreNotReplaced () {
76
114
UseCaseEngine .runTest (
@@ -102,4 +140,22 @@ void testPartialTextReplaceableWithTrailingClause() {
102
140
UseCaseEngine .runTest (
103
141
TEXT4 , ImmutableList .of (new CobolText (REPL4_NAME , REPL4 )), ImmutableMap .of ());
104
142
}
143
+
144
+ @ Test
145
+ void testWhenReplacedLengthIsMoreThanReplaceable () {
146
+ UseCaseEngine .runTest (
147
+ TEXT5 , ImmutableList .of (new CobolText (REPL5_NAME , REPL5 )), ImmutableMap .of ());
148
+ }
149
+
150
+ @ Test
151
+ void testWhenReplacedLengthIsLessThanReplaceable () {
152
+ UseCaseEngine .runTest (
153
+ TEXT6 , ImmutableList .of (new CobolText (REPL6_NAME , REPL6 )), ImmutableMap .of ());
154
+ }
155
+
156
+ @ Test
157
+ void testWhenReplacedLengthIsMoreThanReplaceableAndCopybookHasNoSequence () {
158
+ UseCaseEngine .runTest (
159
+ TEXT7 , ImmutableList .of (new CobolText (REPL7_NAME , REPL7 )), ImmutableMap .of ());
160
+ }
105
161
}
0 commit comments