summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
index 36a72381156..c686a813c9f 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
@@ -62,16 +62,27 @@ public class IntermediateParserTestCase {
@Test
public void multiple_documents_disallowed() throws Exception {
String input = joinLines
- ("schema foo {",
- " document foo {",
- " }",
- " document foo2 {",
- " }",
- "}");
+ ("schema foo {",
+ " document foo {",
+ " }",
+ " document foo2 {",
+ " }",
+ "}");
var e = assertThrows(IllegalArgumentException.class, () -> parseString(input));
assertEquals("schema 'foo' error: already has document 'foo' so cannot add document 'foo2'", e.getMessage());
}
+ @Test
+ public void backwards_path_is_disallowed() {
+ assertThrows("'..' is not allowed in path", IllegalArgumentException.class,
+ () -> parseString("schema foo {\n" +
+ " constant my_constant_tensor {\n" +
+ " file: foo/../bar\n" +
+ " type: tensor<float>(x{},y{})\n" +
+ " }\n" +
+ "}\n"));
+ }
+
void checkFileParses(String fileName) throws Exception {
System.err.println("TRY parsing: "+fileName);
var schema = parseFile(fileName);