09196f826beab4a732a24a92935dde3b5ad393224dd75db3aa01df471d6a9e7dcfc6ca8d24b23b7c104af92dc8a319246d2ffdf1018152ff4faf83ee442066 978 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. var implementation = require('../implementation');
  3. var callBind = require('call-bind');
  4. var test = require('tape');
  5. var hasStrictMode = require('has-strict-mode')();
  6. var runTests = require('./tests');
  7. test('as a function', function (t) {
  8. t.test('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) {
  9. st.test('bad array/this value', { skip: !hasStrictMode }, function (s2t) {
  10. /* eslint no-useless-call: 0 */
  11. s2t['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
  12. s2t['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
  13. s2t.end();
  14. });
  15. runTests(callBind(implementation), st);
  16. st.end();
  17. });
  18. t.test('no ArrayBuffer support', { skip: typeof ArrayBuffer !== 'undefined' }, function (st) {
  19. st['throws'](
  20. function () { implementation.call({}); },
  21. SyntaxError,
  22. 'ArrayBuffer is not supported'
  23. );
  24. });
  25. t.end();
  26. });