aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/defs.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/defs.js b/tests/defs.js
index b00fda0..244e31b 100644
--- a/tests/defs.js
+++ b/tests/defs.js
@@ -58,9 +58,33 @@ test('to_jsstring', function (t) {
});
test('to_jsstring fails on invalid unicode', function (t) {
- t.plan(1);
+ t.plan(7);
t.throws(function() {
defs.to_jsstring([165]);
}, "non-utf8 char");
+
+ t.throws(function() {
+ defs.to_jsstring([208, 60]);
+ }, "invalid continuation byte");
+
+ t.throws(function() {
+ defs.to_jsstring([225, 60, 145]);
+ }, "invalid continuation byte");
+
+ t.throws(function() {
+ defs.to_jsstring([225, 145, 60]);
+ }, "invalid continuation byte");
+
+ t.throws(function() {
+ defs.to_jsstring([242, 60, 145, 145]);
+ }, "invalid continuation byte");
+
+ t.throws(function() {
+ defs.to_jsstring([242, 145, 60, 145]);
+ }, "invalid continuation byte");
+
+ t.throws(function() {
+ defs.to_jsstring([242, 145, 145, 60]);
+ }, "invalid continuation byte");
});