diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java index 993eb0d36..ce4e769ce 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java @@ -41,6 +41,7 @@ import gov.nist.secauto.metaschema.core.metapath.function.IFunction; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.ISequence; +import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IUuidItem; @@ -308,6 +309,24 @@ void testNamedFunctionRefNotFound( : null); } + static Stream testNamedFunctionRefCall() { + return Stream.of( + Arguments.of("fn:string#1(1)", string(String.valueOf(1)))); + } + + @ParameterizedTest + @MethodSource("testNamedFunctionRefCall") + void testNamedFunctionRefCall( + @NonNull String metapath, + @NonNull IItem expectedResult) { + StaticContext staticContext = StaticContext.builder().build(); + DynamicContext dynamicContext = new DynamicContext(staticContext); + + IItem result = IMetapathExpression.compile(metapath, staticContext) + .evaluateAs(null, IMetapathExpression.ResultType.ITEM, dynamicContext); + assertEquals(expectedResult, result); +} + static Stream testComparison() { return Stream.of( Arguments.of("A = B", GeneralComparison.class, ComparisonFunctions.Operator.EQ),