tickets
All repositories: gitoria
2.1 KB
import assert from 'node:assert/strict';import { mkdtempSync, writeFileSync, mkdirSync, readdirSync, rmSync } from 'node:fs';import { spawnSync } from 'node:child_process';import { join, resolve } from 'node:path';const root = resolve(import.meta.dirname, '../../..');const bin = process.env.HL_BIN || join(root, 'native/zig-out/bin/hybriel');const work = mkdtempSync(join(process.env.TMPDIR, 'listdir-lifetime-'));try {const dir = join(work, 'entries');mkdirSync(dir);for (let i = 0; i < 150; i++) writeFileSync(join(dir, String(i).padStart(64, '0') + '.txt'), 'abc');const expected = readdirSync(dir, { withFileTypes: true }).map(e => e.name);const source = join(work, 'walk.hl');writeFileSync(source, `import { listDir, writeFile } from 'hl:fs'import { args } from 'hl:proc'a = args()let rows = []iterator = listDir(a[0])writeFile(a[0] + '/late.txt', 'late')for (entry of iterator) { rows.push(entry) }console.log(JSON.stringify(rows))let early = ''for (entry of listDir(a[0])) { early = entry.namebreak }console.log(early)`);const native = join(work, 'walk');const build = spawnSync(bin, ['--native', source, '-o', native], { encoding: 'utf8' });assert.equal(build.status, 0, build.stdout + build.stderr);const run = spawnSync(native, [dir], { encoding: 'utf8' });assert.equal(run.status, 0, run.stdout + run.stderr);const [json, first] = run.stdout.trim().split('\n');const rows = JSON.parse(json);assert.deepEqual(rows.map(e => e.name).sort(), expected.sort());for (const e of rows) {assert.equal(e.path, join(dir, e.name));assert.equal(e.type, 'file');assert.equal(e.size, 3);assert.equal(e.mime, 'text/plain');assert.equal(typeof e.chmod, 'number');assert.equal(e.user, process.getuid());assert.equal(e.group, process.getgid());assert.deepEqual(Object.keys(e).sort(), ['chmod', 'group', 'mime', 'name', 'path', 'size', 'type', 'user']);}assert.ok(expected.includes(first) || first === 'late.txt');console.log('listDir: 150 retained eight-field entries survive exhaustion; call-time snapshot and early exit pass');} finally { rmSync(work, { recursive: true, force: true }); }
Branches
Latest commits
- 32bcdf24|||PR records: GO P39 K40mre
- 4123c6d1Merge branch 'records-t38' into mainTickets
- cd3641a1|||PR records: day72 deploy live, tickets closedmre
- 7d44d852Merge branch 'records-t37' into mainTickets
- 926f7061|||PR records: merges, D36 deploymre
- bf58534eMerge branch 'l33-final' into mainTickets
- 759a9ac3|||PR thin login (tickets#46, #45): merge main, route entry cleanupmre
- 239436d8Merge remote-tracking branch 'origin/main' into l33-finalmre
- 5822cb3aMerge branch 'o34-clean' into mainTickets
- 0870653c|||PR offline note from __hlOnline, no polling (tickets#41)mre
- 14cf96b4Merge branch 'records-t36' into mainTickets
- 07749fa1|||PR records: day72 + #40 mergedmre
- ecd7e226|||PR Consolidate login and move handler logic into topic libraries (partial)mre
- 6dea1c60Merge branch 'r35-day72' into mainTickets
- 7bcfdc22|||PR drop worker edits to conductor recordsmre
- 2617b6ee|||PR dialogs: host flag cleared on close, dialog gate (tickets#40)mre
- 6e701371|||PR record partial day72 dialog validationmre
- b9fb9a91|||PR bind ticket dialog visibility to member flagsmre
- 0788e65f|||PR re-vendor Hybriel day72mre
- e2a6bdcfMerge branch 'records-t35' into mainTickets