Skip to content

Commit 122a4b4

Browse files
committed
[Tests] add coverage
From tc39/test262#4477
1 parent 430032b commit 122a4b4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/Uint8Array.prototype.setFromHex.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,26 @@ module.exports = {
201201
s2t.end();
202202
});
203203

204+
st.test('test262: test/built-ins/Uint8Array/prototype/setFromHex/throws-when-string-length-is-odd', function (s2t) {
205+
var zeroLength = new Uint8Array(0);
206+
207+
s2t['throws'](
208+
function () { method(zeroLength, '1'); },
209+
SyntaxError,
210+
'Uint8Array has length 0'
211+
);
212+
213+
var nonZeroLength = new Uint8Array(1);
214+
215+
s2t['throws'](
216+
function () { method(nonZeroLength, '1'); },
217+
SyntaxError,
218+
'Uint8Array has length >0'
219+
);
220+
221+
s2t.end();
222+
});
223+
204224
st.end();
205225
});
206226
},

0 commit comments

Comments
 (0)