diff options
author | Lester Solbakken <lesters@oath.com> | 2018-09-10 15:22:08 +0200 |
---|---|---|
committer | Lester Solbakken <lesters@oath.com> | 2018-09-10 15:22:08 +0200 |
commit | 33c0861f6871f5593885b9c7884b60436780e228 (patch) | |
tree | 4e33c462520ee0246ff41b23dfb88032fbbd2697 /config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java | |
parent | a7066e7028de1f35264bbfe164ba950ba5c6752f (diff) |
Don't detect rank expression loops on bound identifiers
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java')
-rw-r--r-- | config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java index c843023d518..df9a40d29e2 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java @@ -3,7 +3,6 @@ package com.yahoo.searchdefinition; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.yolean.Exceptions; -import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -15,7 +14,6 @@ import static org.junit.Assert.fail; public class RankingExpressionLoopDetectionTestCase { @Test - @Ignore // TODO public void testSelfLoop() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SearchBuilder builder = new SearchBuilder(rankProfileRegistry); @@ -48,7 +46,6 @@ public class RankingExpressionLoopDetectionTestCase { } @Test - @Ignore // TODO public void testNestedLoop() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SearchBuilder builder = new SearchBuilder(rankProfileRegistry); @@ -84,7 +81,6 @@ public class RankingExpressionLoopDetectionTestCase { } @Test - @Ignore // TODO public void testSelfArgumentLoop() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SearchBuilder builder = new SearchBuilder(rankProfileRegistry); @@ -114,7 +110,7 @@ public class RankingExpressionLoopDetectionTestCase { fail("Excepted exception"); } catch (IllegalArgumentException e) { - assertEquals("In search definition 'test', rank profile 'test': The first-phase expression is invalid: Invocation loop: foo -> arg(foo) -> a1 -> foo", + assertEquals("In search definition 'test', rank profile 'test': The first-phase expression is invalid: Invocation loop: foo -> arg(foo) -> foo", Exceptions.toMessageString(e)); } } @@ -175,4 +171,27 @@ public class RankingExpressionLoopDetectionTestCase { builder.build(); } + @Test + public void testNoLoopWithBoundIdentifiers() throws ParseException { + RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); + SearchBuilder builder = new SearchBuilder(rankProfileRegistry); + builder.importString( + "search test {\n" + + " document test { \n" + + " }\n" + + " rank-profile test {\n" + + " first-phase {\n" + + " expression: foo(bar(2))\n" + + " }\n" + + " macro foo(x) {\n" + + " expression: x * x\n" + + " }\n" + + " macro bar(x) {\n" + + " expression: x + x\n" + + " }\n" + + " }\n" + + "}\n"); + builder.build(); + } + } |