Also trim monolingual text values.
This commit is contained in:
parent
8b4cf84bfd
commit
604666ed6a
@ -53,7 +53,7 @@ public class WbMonolingualExpr implements WbExpression<MonolingualTextValue> {
|
||||
String text = getValueExpr().evaluate(ctxt).getString();
|
||||
try {
|
||||
String lang = getLanguageExpr().evaluate(ctxt);
|
||||
return Datamodel.makeMonolingualTextValue(text, lang);
|
||||
return Datamodel.makeMonolingualTextValue(text.trim(), lang);
|
||||
|
||||
} catch (SkipSchemaExpressionException e) {
|
||||
QAWarning warning = new QAWarning("monolingual-text-without-language", null, QAWarning.Severity.WARNING, 1);
|
||||
|
@ -44,6 +44,12 @@ public class WbMonolingualExprTest extends WbExpressionTest<MonolingualTextValue
|
||||
evaluatesTo(Datamodel.makeMonolingualTextValue("hello", "en"), expr);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrim() {
|
||||
setRow("en", " hello ");
|
||||
evaluatesTo(Datamodel.makeMonolingualTextValue("hello", "en"), expr);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidLanguageCode() {
|
||||
setRow("ueuue", "my label");
|
||||
|
Loading…
Reference in New Issue
Block a user