This is an automated email from the ASF dual-hosted git repository. sergeykamov pushed a commit to branch x in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 991111496b67fab13cc3edb1edfd94711126164c Author: Sergey Kamov <skhdlem...@gmail.com> AuthorDate: Thu Apr 7 20:25:29 2022 +0300 WIP. --- .../internal/conversation/NCConversationSpec.scala | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala index 112c01af..c7b158c6 100644 --- a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala +++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala @@ -75,3 +75,45 @@ class NCConversationSpec: // 'e1' received from conversation. execOk("e2") } + + def testX(): Unit = + val mdl: NCModel = + new NCTestModelAdapter: + import NCSemanticTestElement as TE + override val getPipeline: NCPipeline = + val pl = mkEnPipeline + pl.getEntityParsers.add(NCTestUtils.mkEnSemanticParser(TE("e1"))) + pl + + @NCIntent("intent=i1 term(t1)~{# == 'e1'}") + def onMatch(im: NCIntentMatch): NCResult = + im.getContext.getConversation.clearStm() + new NCResult() + + Using.resource(new NCModelClient(mdl)) { cli => + def execOk(txt: String): Unit = cli.ask(txt, null, usrId) + def execReject(txt: String): Unit = + try + cli.ask(txt, null, usrId) + require(false) + catch + case e: NCRejection => // OK. + case e: Throwable => throw e + + // missed 'e1' + execReject("e2") + execOk("e1 e2") + + // 'e1' received from conversation. + execOk("e2") + + cli.clearStm(usrId) + cli.clearDialog(usrId) + + // missed 'e1' again. + execReject("e2") + execOk("e1 e2") + + // 'e1' received from conversation. + execOk("e2") + }