diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/non262/TypedArray/set-negative-offset.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/tests/non262/TypedArray/set-negative-offset.js b/js/src/tests/non262/TypedArray/set-negative-offset.js new file mode 100644 index 0000000000..6d9c45ffb2 --- /dev/null +++ b/js/src/tests/non262/TypedArray/set-negative-offset.js @@ -0,0 +1,35 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +var gTestfile = "set-negative-offset.js"; +//----------------------------------------------------------------------------- +var BUGNUMBER = 1140752; +var summary = + "%TypedArray%.prototype.set must throw a RangeError when passed a negative " + + "offset"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +try +{ + new Uint8Array().set([], -1); + throw new Error("didn't throw at all"); +} +catch (e) +{ + assertEq(e instanceof RangeError, true, + "expected RangeError, instead got: " + e); +} + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); |