aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2011-01-30 20:02:16 -0800
committerEthan Jackson <ethan@nicira.com>2011-01-31 14:59:27 -0800
commit656833530941ef21c1a59656a5572b5155d0c302 (patch)
treea014fba56afbb34c3915cfa48cb9167f1e81efe9 /tests
parent9e980142f482f44020f27e5acb7c29e9a8aba9b0 (diff)
tests: Fix tests with UCS-2 Python.
Python can be built with either UCS2 or UCS4 support. When built with UCS2 the python related surrogate pairs tests cannot pass. This commit handles this situation more gracefully.
Diffstat (limited to 'tests')
-rw-r--r--tests/json.at17
-rw-r--r--tests/ovsdb-data.at4
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/json.at b/tests/json.at
index 56329ed2..3962da1c 100644
--- a/tests/json.at
+++ b/tests/json.at
@@ -19,6 +19,18 @@ m4_define([JSON_CHECK_POSITIVE_PY],
])
AT_CLEANUP])
+m4_define([JSON_CHECK_POSITIVE_UCS4PY],
+ [AT_SETUP([$1])
+ AT_KEYWORDS([json positive Python])
+ AT_SKIP_IF([test $HAVE_PYTHON = no])
+ AT_XFAIL_IF([$PYTHON -c "exit(len(u'\U00010800'))"; test $? -ne 1])
+ AT_CHECK([printf %s "AS_ESCAPE([$2])" > input])
+ AT_CAPTURE_FILE([input])
+ AT_CHECK([$PYTHON $srcdir/test-json.py $4 input], [0], [stdout], [])
+ AT_CHECK([cat stdout], [0], [$3
+])
+ AT_CLEANUP])
+
m4_define([JSON_CHECK_POSITIVE],
[JSON_CHECK_POSITIVE_C([$1 - C], [$2], [$3], [$4])
JSON_CHECK_POSITIVE_PY([$1 - Python], [$2], [$3], [$4])])
@@ -75,7 +87,10 @@ JSON_CHECK_POSITIVE([escape sequences],
JSON_CHECK_POSITIVE([Unicode escape sequences],
[[[ " \u0022 \u005c \u002F \u0008 \u000c \u000A \u000d \u0009" ]]],
[[[" \" \\ / \b \f \n \r \t"]]])
-JSON_CHECK_POSITIVE([surrogate pairs],
+JSON_CHECK_POSITIVE_C([surrogate pairs - C],
+ [[["\ud834\udd1e"]]],
+ [[["𝄞"]]])
+JSON_CHECK_POSITIVE_UCS4PY([surrogate pairs - Python],
[[["\ud834\udd1e"]]],
[[["𝄞"]]])
JSON_CHECK_NEGATIVE([a string by itself is not valid JSON], ["xxx"],
diff --git a/tests/ovsdb-data.at b/tests/ovsdb-data.at
index 98e81083..97369619 100644
--- a/tests/ovsdb-data.at
+++ b/tests/ovsdb-data.at
@@ -457,12 +457,12 @@ OVSDB_CHECK_POSITIVE_CPY([strings no more than 2 characters long],
'["a"]' \
'["ab"]' \
'["abc"]' \
- '["\ud834\udd1e"]']],
+ '["de"]']],
[[""
"a"
"ab"
constraint violation: "abc" length 3 is greater than maximum allowed length 2
-"𝄞"]])
+"de"]])
AT_BANNER([OSVDB -- simple data])