Fix commodity namespace tests

While new files will use CURRENCY to indicate a commodity is a currency,
older files (including our ancient test files) are still using
ISO4217. So we need to expect both values in the xml file tests.
This is different from file loading (which will automatically map
ISO4217 to CURRENCY) and file saving (which will from now on always
write CURRENCY).
This commit is contained in:
Geert Janssens 2017-06-21 10:11:54 +02:00
parent f3eeda3a9e
commit 823b41d629

View File

@ -69,8 +69,14 @@ node_and_commodity_equal (xmlNodePtr node, const gnc_commodity* com)
}
else if (g_strcmp0 ((char*)mark->name, "cmdty:space") == 0)
{
/* Currency namespace is now stored as GNC_COMMODITY_NS_CURRENCY
* but used to be stored as GNC_COMMODITY_NS_ISO,
* so check both to cater for (very) old testfiles. */
if (!equals_node_val_vs_string (
mark, gnc_commodity_get_namespace (com)))
mark, gnc_commodity_get_namespace (com)) &&
!((g_strcmp0 (gnc_commodity_get_namespace (com), GNC_COMMODITY_NS_CURRENCY) == 0) &&
equals_node_val_vs_string (
mark, GNC_COMMODITY_NS_ISO)))
{
return "namespaces differ";
}