aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/parameterTest.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2010-04-08 18:28:22 +0000
committerVincent Richard <[email protected]>2010-04-08 18:28:22 +0000
commit8f9fec339c395150fb52205d7337eb61348e2892 (patch)
tree218f7866813bdf50fb83d650e9ff865b09f11323 /tests/parser/parameterTest.cpp
parentMigrated config script for newer versions of SCons. (diff)
downloadvmime-8f9fec339c395150fb52205d7337eb61348e2892.tar.gz
vmime-8f9fec339c395150fb52205d7337eb61348e2892.zip
Fixed parsing of non-significant whitespaces in field values.
Diffstat (limited to 'tests/parser/parameterTest.cpp')
-rw-r--r--tests/parser/parameterTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
index 6d244381..803bb59a 100644
--- a/tests/parser/parameterTest.cpp
+++ b/tests/parser/parameterTest.cpp
@@ -36,6 +36,7 @@ VMIME_TEST_SUITE_BEGIN
VMIME_TEST(testGenerate)
VMIME_TEST(testGenerateRFC2231)
VMIME_TEST(testNonStandardEncodedParam)
+ VMIME_TEST(testParseNonSignificantWS)
VMIME_TEST_LIST_END
@@ -53,6 +54,7 @@ VMIME_TEST_SUITE_BEGIN
};
+#define FIELD_VALUE(f) (f.getValue()->generate())
#define PARAM_VALUE(p, n) (p.getParameterAt(n)->getValue().generate())
#define PARAM_NAME(p, n) (p.getParameterAt(n)->getName())
#define PARAM_CHARSET(p, n) \
@@ -278,5 +280,22 @@ VMIME_TEST_SUITE_BEGIN
VASSERT_EQ("2.3", "Logo VMime.png", PARAM_VALUE(p2, 0));
}
+ // Parse parameters with non-significant whitespaces
+ void testParseNonSignificantWS()
+ {
+ parameterizedHeaderField p1;
+ p1.parse(" \t X \r\n");
+
+ VASSERT_EQ("1.1", "X", FIELD_VALUE(p1));
+
+ parameterizedHeaderField p2;
+ p2.parse(" X ; param1 = value1 \r\n");
+
+ VASSERT_EQ("2.1", 1, p2.getParameterCount());
+ VASSERT_EQ("2.2", "X", FIELD_VALUE(p2));
+ VASSERT_EQ("2.3", "param1", PARAM_NAME(p2, 0));
+ VASSERT_EQ("2.4", "value1", PARAM_VALUE(p2, 0));
+ }
+
VMIME_TEST_SUITE_END