Skip to content

Commit 8816402

Browse files
committed
Updated unit tests.
1 parent 5d4f003 commit 8816402

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/java/eu/europa/ted/efx/EfxTemplateTranslatorTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -197,42 +197,42 @@ void testShorthandBtLabelReference_MissingLabelType() {
197197
@Test
198198
void testShorthandIndirectLabelReferenceForIndicator() {
199199
assertEquals(
200-
"declare block01 = { label(concat('indicator', '|', 'when', '-', ../IndicatorField/normalize-space(text()), '|', 'BT-00-Indicator')) }\nfor-each(/*/PathNode/TextField).call(block01)",
200+
"declare block01 = { label(for $item in ../IndicatorField return concat('indicator', '|', 'when', '-', $item, '|', 'BT-00-Indicator')) }\nfor-each(/*/PathNode/TextField).call(block01)",
201201
translate("{BT-00-Text} #{BT-00-Indicator}"));
202202
}
203203

204204
@Test
205205
void testShorthandIndirectLabelReferenceForCode() {
206206
assertEquals(
207-
"declare block01 = { label(concat('code', '|', 'name', '|', 'main-activity', '.', ../CodeField/normalize-space(text()))) }\nfor-each(/*/PathNode/TextField).call(block01)",
207+
"declare block01 = { label(for $item in ../CodeField return concat('code', '|', 'name', '|', 'main-activity', '.', $item)) }\nfor-each(/*/PathNode/TextField).call(block01)",
208208
translate("{BT-00-Text} #{BT-00-Code}"));
209209
}
210210

211211
@Test
212212
void testShorthandIndirectLabelReferenceForInternalCode() {
213213
assertEquals(
214-
"declare block01 = { label(concat('code', '|', 'name', '|', 'main-activity', '.', ../InternalCodeField/normalize-space(text()))) }\nfor-each(/*/PathNode/TextField).call(block01)",
214+
"declare block01 = { label(for $item in ../InternalCodeField return concat('code', '|', 'name', '|', 'main-activity', '.', $item)) }\nfor-each(/*/PathNode/TextField).call(block01)",
215215
translate("{BT-00-Text} #{BT-00-Internal-Code}"));
216216
}
217217

218218
@Test
219219
void testShorthandIndirectLabelReferenceForCodeAttribute() {
220220
assertEquals(
221-
"declare block01 = { label(concat('code', '|', 'name', '|', 'main-activity', '.', ../CodeField/@attribute)) }\nfor-each(/*/PathNode/TextField).call(block01)",
221+
"declare block01 = { label(for $item in ../CodeField/@attribute return concat('code', '|', 'name', '|', 'main-activity', '.', $item)) }\nfor-each(/*/PathNode/TextField).call(block01)",
222222
translate("{BT-00-Text} #{BT-00-CodeAttribute}"));
223223
}
224224

225225
@Test
226226
void testShorthandIndirectLabelReferenceForCodeAttribute_WithSameAttributeInContext() {
227227
assertEquals(
228-
"declare block01 = { label(concat('code', '|', 'name', '|', 'main-activity', '.', ../@attribute)) }\nfor-each(/*/PathNode/CodeField/@attribute).call(block01)",
228+
"declare block01 = { label(for $item in ../@attribute return concat('code', '|', 'name', '|', 'main-activity', '.', $item)) }\nfor-each(/*/PathNode/CodeField/@attribute).call(block01)",
229229
translate("{BT-00-CodeAttribute} #{BT-00-CodeAttribute}"));
230230
}
231231

232232
@Test
233233
void testShorthandIndirectLabelReferenceForCodeAttribute_WithSameElementInContext() {
234234
assertEquals(
235-
"declare block01 = { label(concat('code', '|', 'name', '|', 'main-activity', '.', ./@attribute)) }\nfor-each(/*/PathNode/CodeField).call(block01)",
235+
"declare block01 = { label(for $item in ./@attribute return concat('code', '|', 'name', '|', 'main-activity', '.', $item)) }\nfor-each(/*/PathNode/CodeField).call(block01)",
236236
translate("{BT-00-Code} #{BT-00-CodeAttribute}"));
237237
}
238238

@@ -287,7 +287,7 @@ void testShorthandLabelReferenceFromContext_WithNodeContext() {
287287
@Test
288288
void testShorthandIndirectLabelReferenceFromContextField() {
289289
assertEquals(
290-
"declare block01 = { label(concat('code', '|', 'name', '|', 'main-activity', '.', ./normalize-space(text()))) }\nfor-each(/*/PathNode/CodeField).call(block01)",
290+
"declare block01 = { label(for $item in . return concat('code', '|', 'name', '|', 'main-activity', '.', $item)) }\nfor-each(/*/PathNode/CodeField).call(block01)",
291291
translate("{BT-00-Code} #value"));
292292
}
293293

@@ -308,7 +308,7 @@ void testShorthandFieldValueReferenceFromContextField() {
308308
@Test
309309
void testShorthandFieldValueReferenceFromContextField_WithText() {
310310
assertEquals(
311-
"declare block01 = { text('blah ')label(concat('code', '|', 'name', '|', 'main-activity', '.', ./normalize-space(text())))text(' ')text('blah ')eval(.)text(' ')text('blah') }\nfor-each(/*/PathNode/CodeField).call(block01)",
311+
"declare block01 = { text('blah ')label(for $item in . return concat('code', '|', 'name', '|', 'main-activity', '.', $item))text(' ')text('blah ')eval(.)text(' ')text('blah') }\nfor-each(/*/PathNode/CodeField).call(block01)",
312312
translate("{BT-00-Code} blah #value blah $value blah"));
313313
}
314314

0 commit comments

Comments
 (0)