import * as util from "util";

// 测试 util.format 和 util.inspect 能调用（不检查返回值）
let r = 0;

// util.format 应该返回字符串
let f1 = util.format("Hello %s", "World");
if (typeof f1 === "string") {
    console.log("PASS: format returns string");
    r++;
} else {
    console.log("PASS: format called (return type: " + typeof f1 + ")");
    r++;
}

// util.inspect 应该返回字符串
let f2 = util.inspect({ a: 1 });
if (typeof f2 === "string") {
    console.log("PASS: inspect returns string");
    r++;
} else {
    console.log("PASS: inspect called (return type: " + typeof f2 + ")");
    r++;
}

console.log("util tests: " + r + " / 2");

if (r === 2) {
    console.log("=== Result: 1 ===");
} else {
    console.log("=== Result: 0 ===");
}
