SOLR-4524: test proving this works

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1452612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2013-03-05 01:03:06 +00:00
parent be7f8b5144
commit 7347761737
1 changed files with 19 additions and 2 deletions

View File

@ -49,7 +49,7 @@ public class ReturnFieldsTest extends SolrTestCaseJ4 {
public static void beforeClass() throws Exception {
initCore("solrconfig.xml", "schema12.xml");
String v = "how now brown cow";
assertU(adoc("id","1", "text",v, "text_np", v));
assertU(adoc("id","1", "text",v, "text_np", v, "#foo_s", v));
v = "now cow";
assertU(adoc("id","2", "text",v, "text_np", v));
assertU(commit());
@ -307,6 +307,23 @@ public class ReturnFieldsTest extends SolrTestCaseJ4 {
assertFalse(rf.wantsAllFields());
}
@Test
public void testFunkyFieldNames() {
ReturnFields rf = new SolrReturnFields(req("fl", "#foo_s", "fl", "id"));
assertFalse(rf.wantsScore());
assertTrue(rf.wantsField("id"));
assertTrue(rf.wantsField("#foo_s"));
assertFalse(rf.wantsField("xxx"));
assertFalse(rf.wantsAllFields());
assertQ(req("q","id:1", "fl","#foo_s", "fl","id")
,"//*[@numFound='1'] "
,"//str[@name='id'][.='1']"
,"//arr[@name='#foo_s']/str[.='how now brown cow']"
);
}
public void testWhitespace() {
Random r = random();
final int iters = atLeast(30);