This is an automated email from the ASF dual-hosted git repository. sergeykamov pushed a commit to branch NLPCRAFT-283 in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 62c91839ffbac2cdeec88293d307041703427a19 Author: Sergey Kamov <[email protected]> AuthorDate: Thu Mar 25 11:54:34 2021 +0300 WIP. --- .../model/intent/idl/compiler/functions/NCIdlFunctions.scala | 9 +++++++-- .../idl/compiler/functions}/NCIdlFunctionsCustom.scala | 10 ++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctions.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctions.scala index aa88297..2674401 100644 --- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctions.scala +++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctions.scala @@ -31,7 +31,7 @@ import scala.language.implicitConversions /** * Tests for IDL functions. */ -trait NCIdlFunctions { +private[functions] trait NCIdlFunctions { private final val MODEL_ID = "test.mdl.id" final val MODEL: NCModel = new NCModel { @@ -206,7 +206,12 @@ trait NCIdlFunctions { require(false) } catch { - case e: Exception ⇒ println(s"Expected error: ${e.getLocalizedMessage}") + case e: Exception ⇒ + e.getCause match { + case cause: NCE ⇒ println(s"Expected error: ${cause.getLocalizedMessage}") + case _ ⇒ println(s"Expected error: ${e.getLocalizedMessage}") + } + } protected implicit def convert(pred: String): TestDesc = TestDesc(truth = pred) diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCIdlFunctionsCustom.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala similarity index 81% rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCIdlFunctionsCustom.scala rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala index 8f00078..cc2e543 100644 --- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCIdlFunctionsCustom.scala +++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala @@ -15,10 +15,9 @@ * limitations under the License. */ -package org.apache.nlpcraft.model.dialog +package org.apache.nlpcraft.model.intent.idl.compiler.functions import org.apache.nlpcraft.model.{NCTokenPredicateContext, NCTokenPredicateResult} -import org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlFunctions import org.junit.jupiter.api.Test class NCIdlFunctionsCustomImpl { @@ -34,7 +33,7 @@ class NCIdlFunctionsCustom extends NCIdlFunctions { def testErrors(): Unit = { expectError( TestDesc( - truth = "org.apache.nlpcraft.model.dialog.NCIdlFunctionsCustomImpl#missed", + truth = "org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlFunctionsCustomImpl#missed", isCustom = true, token = Some(tkn(txt = "123")), expectedTokensUsed = Some(1) @@ -42,18 +41,17 @@ class NCIdlFunctionsCustom extends NCIdlFunctions { ) } - @Test def test(): Unit = test( TestDesc( - truth = "org.apache.nlpcraft.model.dialog.NCIdlFunctionsCustomImpl#trueOn123", + truth = "org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlFunctionsCustomImpl#trueOn123", isCustom = true, token = Some(tkn(txt = "123")), expectedTokensUsed = Some(1) ), TestDesc( - truth = "org.apache.nlpcraft.model.dialog.NCIdlFunctionsCustomImpl#trueOn123", + truth = "org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlFunctionsCustomImpl#trueOn123", isCustom = true, token = Some(tkn(txt = "456")), expectedRes = false,
