blob: 555670f5b22f7b6afc0b3f7ab3786ddaa5a17c1c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.indexinglanguage.parser;
import com.yahoo.document.datatypes.StringFieldValue;
import com.yahoo.vespa.indexinglanguage.expressions.*;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author Simon Thoresen Hult
*/
public class FieldNameTestCase {
@Test
public void requireThatDotCanBeUsedInFieldName() throws ParseException {
assertEquals(new AttributeExpression("foo.bar"), Expression.fromString("attribute foo . bar"));
assertEquals(new IndexExpression("foo.bar"), Expression.fromString("index foo . bar"));
assertEquals(new SummaryExpression("foo.bar"), Expression.fromString("summary foo . bar"));
}
@Test
public void requireThatCatDotIsNotConfusedWithFieldName() throws ParseException {
assertEquals(new CatExpression(new InputExpression("foo"), new InputExpression("bar")),
Expression.fromString("input foo . input bar"));
assertEquals(new CatExpression(new InputExpression("foo"), new ConstantExpression(new StringFieldValue("bar"))),
Expression.fromString("input foo . 'bar'"));
}
}
|