// Auto-generated by scripts/gen_parity_tests.py from docs/runtime-parity.md.
// Module: node:util
// This file is a byte-for-byte parity test against `node --experimental-strip-types`.
// Edit the TODO lines below to exercise each API; rerun
// `./run_parity_tests.sh --filter test_parity_util` to verify.

import * as util from "node:util";


// ── Functions ──
try {
  console.log("callbackify typeof:", typeof util.callbackify);
  console.log("debuglog typeof:", typeof util.debuglog);
  console.log("debug typeof:", typeof util.debug);
  console.log("deprecate typeof:", typeof util.deprecate);
  console.log("format str+num:", util.format("%s + %d = %d", "a", 1, 2));
  console.log("format json:", util.format("obj=%j", {x: 1, y: "two"}));
  console.log("format object pct-o:", util.format("o=%o", {a: 1}));
  console.log("format percent literal:", util.format("100%% done"));
  console.log("formatWithOptions:", util.formatWithOptions({colors: false}, "%s=%d", "k", 7));
} catch (e) {
  console.log("format area error:", (e as Error).message);
}
console.log("getCallSites typeof:", typeof util.getCallSites);
console.log("getSystemErrorName E2BIG:", util.getSystemErrorName(-7));
console.log("util.getSystemErrorMap():", util.getSystemErrorMap());
console.log("getSystemErrorMessage typeof:", typeof util.getSystemErrorMessage);
console.log("inherits typeof:", typeof util.inherits);
try {
  console.log("inspect simple:", util.inspect({a: 1, b: "two", c: [3, 4]}));
  console.log("inspect depth:", util.inspect({a: {b: {c: 1}}}, {depth: 1}));
  console.log("inspect breakLength:", util.inspect({k: "v"}, {breakLength: Infinity}));
} catch (e) {
  console.log("inspect area error:", (e as Error).message);
}
console.log("isDeepStrictEqual same:", util.isDeepStrictEqual({a: 1}, {a: 1}));
console.log("isDeepStrictEqual diff:", util.isDeepStrictEqual({a: 1}, {a: 2}));
try {
  const pa = util.parseArgs({args: ["--name", "test"], options: {name: {type: "string"}}});
  console.log("parseArgs values.name:", pa.values.name);
  console.log("parseArgs positionals len:", pa.positionals.length);
} catch (e) {
  console.log("parseArgs error:", (e as Error).message);
}
try {
  const pe = util.parseEnv("FOO=bar\nBAZ=qux");
  console.log("parseEnv FOO:", pe.FOO);
  console.log("parseEnv BAZ:", pe.BAZ);
} catch (e) {
  console.log("parseEnv error:", (e as Error).message);
}
try {
  const pSetTimeout = util.promisify(setTimeout);
  console.log("promisify typeof:", typeof pSetTimeout);
} catch (e) {
  console.log("promisify error:", (e as Error).message);
}
console.log("stripVTControlCharacters:", util.stripVTControlCharacters("[31mred[0m"));
try {
  console.log("styleText typeof:", typeof util.styleText);
} catch (e) {
  console.log("styleText error:", (e as Error).message);
}
console.log("toUSVString:", util.toUSVString("hello"));
console.log("util.transferableAbortController():", util.transferableAbortController());
console.log("transferableAbortSignal typeof:", typeof util.transferableAbortSignal);
console.log("aborted typeof:", typeof util.aborted);
console.log("convertProcessSignalToExitCode typeof:", typeof util.convertProcessSignalToExitCode);
console.log("diff typeof:", typeof util.diff);
console.log("setTraceSigInt typeof:", typeof util.setTraceSigInt);

// ── Classes ──
try {
  const mt = new util.MIMEType("text/html;charset=utf-8");
  console.log("MIMEType class typeof:", typeof util.MIMEType);
  console.log("MIMEType.type:", mt.type);
  console.log("MIMEType.subtype:", mt.subtype);
  console.log("MIMEType.essence:", mt.essence);
  console.log("MIMEType.params typeof:", typeof mt.params);
  console.log("MIMEType.toString:", mt.toString());
  console.log("MIMEType.toJSON:", mt.toJSON());
} catch (e) {
  console.log("MIMEType area error:", (e as Error).message);
}
try {
  const mt2 = new util.MIMEType("application/json;charset=utf-8;v=1");
  const mp = mt2.params;
  console.log("MIMEParams class typeof:", typeof util.MIMEParams);
  console.log("MIMEParams.has charset:", mp.has("charset"));
  console.log("MIMEParams.get charset:", mp.get("charset"));
  mp.set("foo", "bar");
  console.log("MIMEParams.get foo after set:", mp.get("foo"));
  mp.delete("foo");
  console.log("MIMEParams.has foo after delete:", mp.has("foo"));
  const keys: string[] = [];
  for (const k of mp.keys()) keys.push(k);
  console.log("MIMEParams.keys sorted:", keys.sort().join(","));
  const vals: string[] = [];
  for (const v of mp.values()) vals.push(v);
  console.log("MIMEParams.values sorted:", vals.sort().join(","));
  const ents: string[] = [];
  for (const [k, v] of mp.entries()) ents.push(k + "=" + v);
  console.log("MIMEParams.entries sorted:", ents.sort().join(";"));
} catch (e) {
  console.log("MIMEParams area error:", (e as Error).message);
}
console.log("util.TextDecoder typeof:", typeof util.TextDecoder);
console.log("util.TextEncoder typeof:", typeof util.TextEncoder);

// ── util.inspect properties ──
console.log("util.inspect.custom:", util.inspect.custom);
console.log("util.inspect.defaultOptions:", util.inspect.defaultOptions);
console.log("util.inspect.styles:", util.inspect.styles);
console.log("util.inspect.colors:", util.inspect.colors);
console.log("util.promisify.custom:", util.promisify.custom);

// ── util.types predicates ──
try {
  console.log("isAnyArrayBuffer:", util.types.isAnyArrayBuffer(new ArrayBuffer(4)));
  console.log("isArrayBuffer:", util.types.isArrayBuffer(new ArrayBuffer(4)));
  console.log("isArrayBufferView:", util.types.isArrayBufferView(new Uint8Array(4)));
  console.log("isArgumentsObject:", util.types.isArgumentsObject({}));
  console.log("isAsyncFunction:", util.types.isAsyncFunction(async () => 0));
  console.log("isBigInt64Array:", util.types.isBigInt64Array(new BigInt64Array(2)));
  console.log("isBigUint64Array:", util.types.isBigUint64Array(new BigUint64Array(2)));
  console.log("isBooleanObject:", util.types.isBooleanObject(true));
  console.log("isBoxedPrimitive:", util.types.isBoxedPrimitive(Object(true)));
  console.log("isCryptoKey:", util.types.isCryptoKey({}));
  console.log("isDataView:", util.types.isDataView(new DataView(new ArrayBuffer(4))));
  console.log("isDate:", util.types.isDate(new Date(0)));
  console.log("isExternal:", util.types.isExternal({}));
  console.log("isFloat16Array typeof predicate:", typeof util.types.isFloat16Array);
  console.log("isFloat32Array:", util.types.isFloat32Array(new Float32Array(2)));
  console.log("isFloat64Array:", util.types.isFloat64Array(new Float64Array(2)));
  console.log("isGeneratorFunction:", util.types.isGeneratorFunction(function*() {}));
  console.log("isGeneratorObject:", util.types.isGeneratorObject({}));
  console.log("isInt8Array:", util.types.isInt8Array(new Int8Array(2)));
  console.log("isInt16Array:", util.types.isInt16Array(new Int16Array(2)));
  console.log("isInt32Array:", util.types.isInt32Array(new Int32Array(2)));
  console.log("isKeyObject:", util.types.isKeyObject({}));
  console.log("isMap:", util.types.isMap(new Map()));
  console.log("isMapIterator:", util.types.isMapIterator(new Map().keys()));
  console.log("isModuleNamespaceObject:", util.types.isModuleNamespaceObject({}));
  console.log("isNativeError:", util.types.isNativeError(new Error("x")));
  console.log("isNumberObject:", util.types.isNumberObject(0));
  console.log("isPromise:", util.types.isPromise(Promise.resolve(1)));
  console.log("isProxy:", util.types.isProxy({}));
  console.log("isRegExp:", util.types.isRegExp(/x/));
  console.log("isSet:", util.types.isSet(new Set()));
  console.log("isSetIterator:", util.types.isSetIterator(new Set().keys()));
  console.log("isSharedArrayBuffer typeof predicate:", typeof util.types.isSharedArrayBuffer);
  console.log("isStringObject:", util.types.isStringObject(""));
  console.log("isSymbolObject:", util.types.isSymbolObject(Symbol("x")));
  console.log("isTypedArray:", util.types.isTypedArray(new Uint8Array(2)));
  console.log("isUint8Array:", util.types.isUint8Array(new Uint8Array(2)));
  console.log("isUint8ClampedArray:", util.types.isUint8ClampedArray(new Uint8ClampedArray(2)));
  console.log("isUint16Array:", util.types.isUint16Array(new Uint16Array(2)));
  console.log("isUint32Array:", util.types.isUint32Array(new Uint32Array(2)));
  console.log("isWeakMap:", util.types.isWeakMap(new WeakMap()));
  console.log("isWeakSet:", util.types.isWeakSet(new WeakSet()));
} catch (e) {
  console.log("util.types area error:", (e as Error).message);
}

// ── Deprecated APIs ──
// Most of these were removed in current Node; probe via typeof to keep parity stable.
try {
  console.log("_extend typeof:", typeof util._extend);
  console.log("isArray typeof:", typeof util.isArray);
  console.log("isBoolean typeof:", typeof util.isBoolean);
  console.log("isBuffer typeof:", typeof util.isBuffer);
  console.log("isDate-deprecated typeof:", typeof util.isDate);
  console.log("isError typeof:", typeof util.isError);
  console.log("isFunction typeof:", typeof util.isFunction);
  console.log("isNull typeof:", typeof util.isNull);
  console.log("isNullOrUndefined typeof:", typeof util.isNullOrUndefined);
  console.log("isNumber typeof:", typeof util.isNumber);
  console.log("isObject typeof:", typeof util.isObject);
  console.log("isPrimitive typeof:", typeof util.isPrimitive);
  console.log("isRegExp-deprecated typeof:", typeof util.isRegExp);
  console.log("isString typeof:", typeof util.isString);
  console.log("isSymbol typeof:", typeof util.isSymbol);
  console.log("isUndefined typeof:", typeof util.isUndefined);
  console.log("log typeof:", typeof util.log);
  console.log("print typeof:", typeof util.print);
  console.log("puts typeof:", typeof util.puts);
  console.log("error typeof:", typeof util.error);
} catch (e) {
  console.log("deprecated area error:", (e as Error).message);
}

// Coverage: 7 auto-emitted, 102 TODO, 0 skip-listed.
