summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2017-05-03 23:03:09 +0100
committerReuben Thomas <rrt@sc3d.org>2017-05-04 21:17:14 +0100
commitba110616a7f871fdbbed50833b58d99e56499b35 (patch)
treefbfe4316aba3908891f8eb0793646e4fbaab0221 /tests
parent749f3ed48ff813c6aa8bb6fd9bbb5358a1004a36 (diff)
downloadenchant-ba110616a7f871fdbbed50833b58d99e56499b35.tar.gz
Tidy up main library code
Mostly to use C99-style declarations, moving declarations just before first use. Also make some code simplifications.
Diffstat (limited to 'tests')
-rw-r--r--tests/broker/enchant_broker_set_ordering_tests.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/tests/broker/enchant_broker_set_ordering_tests.cpp b/tests/broker/enchant_broker_set_ordering_tests.cpp
index 861e133..b682c8b 100644
--- a/tests/broker/enchant_broker_set_ordering_tests.cpp
+++ b/tests/broker/enchant_broker_set_ordering_tests.cpp
@@ -165,14 +165,14 @@ TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
EnchantBrokerSetOrdering_WhitespaceAroundProvider)
{
- enchant_broker_set_ordering(_broker, "qaa", "\n\f\t\r mock2\n \f\t\r,mock1");
+ enchant_broker_set_ordering(_broker, "qaa", "\n\f\t mock2\n \f\t,mock1");
CHECK_EQUAL(Mock2ThenMock1, GetProviderOrder("qaa"));
}
TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
EnchantBrokerSetOrdering_WhitespaceAroundProviderAfterComma)
{
- enchant_broker_set_ordering(_broker, "qaa", "aspell,\n\f\t \rmock2\n\f \r\t,mock1");
+ enchant_broker_set_ordering(_broker, "qaa", "aspell,\n\f\t mock2\n\f \t,mock1");
CHECK_EQUAL(Mock2ThenMock1, GetProviderOrder("qaa"));
}
@@ -217,7 +217,7 @@ TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
EnchantBrokerSetOrdering_WhitespaceSurroundingLanguageTag_Removed)
{
- enchant_broker_set_ordering(_broker, "\n\r qaa \t\f", "mock2,mock1");
+ enchant_broker_set_ordering(_broker, "\n qaa \t\f", "mock2,mock1");
CHECK_EQUAL(Mock2ThenMock1, GetProviderOrder("qaa"));
}
@@ -330,6 +330,18 @@ TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
enchant_broker_set_ordering(_broker, "en_GB", "");
}
+// FIXME: This test passes trivially, as the providers mock1 and mock2 are
+// added to the end of the providers list in any case. Change the tests so
+// that we can detect whether they were explicitly called or not. This
+// will allow us to add CHECKs to the foregoing tests as well.
+TEST_FIXTURE(EnchantBrokerFileSetOrdering_TestFixture,
+ EnchantBrokerFileOrdering_CarriageReturnEndsLine_NotNeitherCalled)
+{
+ WriteStringToOrderingFile(GetEnchantConfigDir(),"en_GB:\rmock1,mock2");
+ InitializeBroker();
+
+ CHECK(ErrorNeitherCalled != GetProviderOrder("en_GB"));
+}
/*
* Ordering can also be set in enchant.ordering file:
@@ -384,16 +396,16 @@ TEST_FIXTURE(EnchantBrokerFileSetOrdering_TestFixture,
TEST_FIXTURE(EnchantBrokerFileSetOrdering_TestFixture,
EnchantBrokerFileOrdering_ExtraSpacesAndTabs_Mock1Then2)
{
- WriteStringToOrderingFile(GetEnchantConfigDir(),"\t en_GB\f \t:\r\t mock1\t , \tmock2\t ");
+ WriteStringToOrderingFile(GetEnchantConfigDir(),"\t en_GB\f \t:\t mock1\t , \tmock2\t ");
InitializeBroker();
-
+
CHECK_EQUAL(Mock1ThenMock2, GetProviderOrder("en_GB"));
}
TEST_FIXTURE(EnchantBrokerFileSetOrdering_TestFixture,
- EnchantBrokerFileOrdering_ExtraSpaces_Mock2Then1)
+ EnchantBrokerFileOrdering_ExtraSpacesAndTabs_Mock2Then1)
{
- WriteStringToOrderingFile(GetEnchantConfigDir()," \ten_GB\t \f:\r \tmock2 \t,\t mock1 \t");
+ WriteStringToOrderingFile(GetEnchantConfigDir()," \ten_GB\t \f: \tmock2 \t,\t mock1 \t");
InitializeBroker();
CHECK_EQUAL(Mock2ThenMock1, GetProviderOrder("en_GB"));