You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
924 B

4 years ago
  1. var inspect = require('../');
  2. var test = require('tape');
  3. test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
  4. t.test('primitives', function (st) {
  5. st.plan(3);
  6. st.equal(inspect(BigInt(-256)), '-256n');
  7. st.equal(inspect(BigInt(0)), '0n');
  8. st.equal(inspect(BigInt(256)), '256n');
  9. });
  10. t.test('objects', function (st) {
  11. st.plan(3);
  12. st.equal(inspect(Object(BigInt(-256))), 'Object(-256n)');
  13. st.equal(inspect(Object(BigInt(0))), 'Object(0n)');
  14. st.equal(inspect(Object(BigInt(256))), 'Object(256n)');
  15. });
  16. t.test('syntactic primitives', function (st) {
  17. st.plan(3);
  18. /* eslint-disable no-new-func */
  19. st.equal(inspect(Function('return -256n')()), '-256n');
  20. st.equal(inspect(Function('return 0n')()), '0n');
  21. st.equal(inspect(Function('return 256n')()), '256n');
  22. });
  23. t.end();
  24. });