diff options
Diffstat (limited to 'desktop/modules/perf/test_perf.js')
| -rw-r--r-- | desktop/modules/perf/test_perf.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/desktop/modules/perf/test_perf.js b/desktop/modules/perf/test_perf.js index 5f39f5d..ac5859d 100644 --- a/desktop/modules/perf/test_perf.js +++ b/desktop/modules/perf/test_perf.js @@ -9,7 +9,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// Run: node desktop/island/perf/test_perf.js +// Run: node desktop/modules/perf/test_perf.js // Perf.js is a QML library, so its .pragma line is stripped before node // evaluates it, as test_controls.js does for Controls.js. @@ -19,7 +19,7 @@ const assert = require("assert"); const src = fs.readFileSync(__dirname + "/Perf.js", "utf8") .replace(/^\.pragma library$/m, ""); const P = new Function(src + "\nreturn { cpuTimes, load, meminfo, df, vram, rate, " + - "hwmonMap, lanAddr, cpuModel, band, worst, isIPv4, parsePubip, formatPubip, " + + "hwmonMap, lanAddr, cpuModel, du, band, worst, isIPv4, parsePubip, formatPubip, " + "ipCheck, due, push, bytes, speed };")(); // cpuTimes: aggregate first, then cores; idle is idle + iowait. @@ -150,4 +150,10 @@ assert.strictEqual(P.bytes(null), "--"); assert.strictEqual(P.speed(1024 * 1024 * 1.2), "1.2M/s"); assert.strictEqual(P.speed(null), "--"); +// du: total is the directory's own (largest) line; children largest first. +const cache = P.du("5\t/c/b\n9\t/c/a b\n20\t/c\n"); +assert.strictEqual(cache.total, 20); +assert.deepStrictEqual(cache.items, [{ name: "a b", bytes: 9 }, { name: "b", bytes: 5 }]); +assert.strictEqual(P.du(""), null); + console.log("test_perf: ok"); |
