+
+
+void test_chain_empty_token(void)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ struct icu_chain * chain = 0;
+
+ const char * xml_str = "<icu_chain id=\"en:word\" locale=\"el\">"
+ "<normalize rule=\"Remove\"/>"
+ "<normalize rule=\"Lower\"/>"
+ "<index/>"
+ "</icu_chain>";
+
+ xmlDoc *doc = xmlParseMemory(xml_str, strlen(xml_str));
+ xmlNode *xml_node = xmlDocGetRootElement(doc);
+ YAZ_CHECK(xml_node);
+
+ chain = icu_chain_xml_config(xml_node, &status);
+
+ xmlFreeDoc(doc);
+ YAZ_CHECK(chain);
+
+ YAZ_CHECK(icu_chain_assign_cstr(
+ chain, " ",
+ &status));
+
+ while (icu_chain_next_token(chain, &status)){
+ ;
+ printf("%d '%s' '%s'\n",
+ icu_chain_get_token_count(chain),
+ icu_chain_get_norm(chain),
+ icu_chain_get_display(chain));
+ }
+
+ // this should result in one toke, namely the empty token '',
+ // but it has none.
+ YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 0);
+
+ icu_chain_destroy(chain);
+}
+