BigInt.prototype.valueOf.js 492 B

1234567891011121314151617181920
  1. load("test-common.js");
  2. try {
  3. assert(BigInt.prototype.valueOf.length === 0);
  4. assertThrowsError(() => {
  5. BigInt.prototype.valueOf.call("foo");
  6. }, {
  7. error: TypeError,
  8. message: "Not a BigInt object"
  9. });
  10. assert(typeof BigInt(123).valueOf() === "bigint");
  11. // FIXME: Uncomment once we support Object() with argument
  12. // assert(typeof Object(123n).valueOf() === "bigint");
  13. console.log("PASS");
  14. } catch (e) {
  15. console.log("FAIL: " + e);
  16. }