SOLR-2468: fix test added by SOLR-2335 that doesn't work on windows (double-quote in file name)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1092451 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2011-04-14 19:32:41 +00:00
parent c3f6331639
commit a5d2b89dff
1 changed files with 32 additions and 4 deletions

View File

@ -523,11 +523,12 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
* verify that both the field("...") value source parser as well as
* ExternalFileField work with esoteric field names
*/
@Test @Ignore("fails on some platforms: see https://issues.apache.org/jira/browse/SOLR-2468")
@Test
public void testExternalFieldValueSourceParser() {
clearIndex();
String field = "CoMpleX \" fieldName _extf";
String fieldAsFunc = "field(\"CoMpleX \\\" fieldName _extf\")";
String field = "CoMpleX fieldName _extf";
String fieldAsFunc = "field(\"CoMpleX fieldName _extf\")";
float[] ids = {100,-4,0,10,25,5,77,23,55,-78,-45,-24,63,78,94,22,34,54321,261,-627};
@ -544,7 +545,7 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
singleTest(fieldAsFunc, "sqrt(\0)");
assertTrue(orig == FileFloatSource.onlyForTesting);
makeExternalFile(fieldAsFunc, "0=1","UTF-8");
makeExternalFile(field, "0=1","UTF-8");
assertU(adoc("id", "10000")); // will get same reader if no index change
assertU(commit());
singleTest(fieldAsFunc, "sqrt(\0)");
@ -553,4 +554,31 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
purgeFieldCache(FieldCache.DEFAULT); // avoid FC insanity
}
/**
* some platforms don't allow quote characters in filenames, so
* in addition to testExternalFieldValueSourceParser above, test a field
* name with quotes in it that does NOT use ExternalFileField
* @see #testExternalFieldValueSourceParser
*/
@Test
public void testFieldValueSourceParser() {
clearIndex();
String field = "CoMpleX \" fieldName _f";
String fieldAsFunc = "field(\"CoMpleX \\\" fieldName _f\")";
float[] ids = {100,-4,0,10,25,5,77,1};
createIndex(field, ids);
// test identity (straight field value)
singleTest(fieldAsFunc, "\0",
100,100, -4,-4, 0,0, 10,10, 25,25, 5,5, 77,77, 1,1);
singleTest(fieldAsFunc, "sqrt(\0)",
100,10, 25,5, 0,0, 1,1);
singleTest(fieldAsFunc, "log(\0)", 1,0);
purgeFieldCache(FieldCache.DEFAULT); // avoid FC insanity
}
}