···11// Test toStringTag for all modules
2233-console.log('Testing @@toStringTag for all modules:\n');
33+console.log('Testing Symbol.toStringTag for all modules:\n');
4455// Built-in modules
66console.log('Atomics:', Object.prototype.toString.call(Atomics));
+19-16
tests/test_toString.cjs
···11// Test Object.prototype.toString
2233-console.log("Testing Object.prototype.toString:");
33+console.log('Testing Object.prototype.toString:');
4455-// Test with Atomics (has @@toStringTag)
66-console.log("Object.prototype.toString.call(Atomics):", Object.prototype.toString.call(Atomics));
55+// Test with Atomics (has Symbol.toStringTag)
66+console.log('Object.prototype.toString.call(Atomics):', Object.prototype.toString.call(Atomics));
7788// Test with other built-ins
99-console.log("\nOther types:");
1010-console.log("Object.prototype.toString.call({}):", Object.prototype.toString.call({}));
1111-console.log("Object.prototype.toString.call([]):", Object.prototype.toString.call([]));
1212-console.log("Object.prototype.toString.call(function(){}):", Object.prototype.toString.call(function(){}));
1313-console.log("Object.prototype.toString.call(42):", Object.prototype.toString.call(42));
1414-console.log("Object.prototype.toString.call('hello'):", Object.prototype.toString.call("hello"));
1515-console.log("Object.prototype.toString.call(true):", Object.prototype.toString.call(true));
1616-console.log("Object.prototype.toString.call(null):", Object.prototype.toString.call(null));
1717-console.log("Object.prototype.toString.call(undefined):", Object.prototype.toString.call(undefined));
99+console.log('\nOther types:');
1010+console.log('Object.prototype.toString.call({}):', Object.prototype.toString.call({}));
1111+console.log('Object.prototype.toString.call([]):', Object.prototype.toString.call([]));
1212+console.log(
1313+ 'Object.prototype.toString.call(function(){}):',
1414+ Object.prototype.toString.call(function () {})
1515+);
1616+console.log('Object.prototype.toString.call(42):', Object.prototype.toString.call(42));
1717+console.log("Object.prototype.toString.call('hello'):", Object.prototype.toString.call('hello'));
1818+console.log('Object.prototype.toString.call(true):', Object.prototype.toString.call(true));
1919+console.log('Object.prototype.toString.call(null):', Object.prototype.toString.call(null));
2020+console.log('Object.prototype.toString.call(undefined):', Object.prototype.toString.call(undefined));
18211919-// Test with custom @@toStringTag
2020-console.log("\nCustom @@toStringTag:");
2121-const custom = { "@@toStringTag": "MyCustomType" };
2222-console.log("Object.prototype.toString.call(custom):", Object.prototype.toString.call(custom));
2222+// Test with custom Symbol.toStringTag
2323+console.log('\nCustom Symbol.toStringTag:');
2424+const custom = { [Symbol.toStringTag]: 'MyCustomType' };
2525+console.log('Object.prototype.toString.call(custom):', Object.prototype.toString.call(custom));
-23
tests/test_toString_simple.cjs
···11-// Test Object.prototype.toString directly
22-33-console.log("Testing toString:");
44-55-// Test on objects directly
66-const obj = {};
77-console.log("obj.toString():", obj.toString());
88-99-const arr = [];
1010-console.log("arr.toString():", arr.toString());
1111-1212-const atomics = Atomics;
1313-console.log("Atomics object:", atomics);
1414-console.log("Atomics.toString:", atomics.toString);
1515-1616-// If toString exists, call it
1717-if (atomics.toString) {
1818- console.log("Calling Atomics.toString():", atomics.toString());
1919-}
2020-2121-// Test custom object with @@toStringTag
2222-const custom = { "@@toStringTag": "MyCustomType" };
2323-console.log("custom.toString():", custom.toString());