Keep the explorer's measurement fixture in the sandbox
The three file sizes the viewer's and the editor's limits were measured against are built by ui-sandbox.sh now, beside the rest of the explorer's fixture tree, so the figures in EXPLORER.md can be taken again instead of each session inventing its own generated file and getting a slightly different one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c12274285
commit
121a47da6e
1 file changed
+27
@@ -281,6 +281,33 @@ chmod 000 "$FILES/unreadable.txt"
|
|||||||
printf 'in a subdirectory\n' >"$FILES/sub/inside.txt"
|
printf 'in a subdirectory\n' >"$FILES/sub/inside.txt"
|
||||||
ln -sfn sub "$FILES/link-to-sub"
|
ln -sfn sub "$FILES/link-to-sub"
|
||||||
ln -sfn nowhere "$FILES/broken-link"
|
ln -sfn nowhere "$FILES/broken-link"
|
||||||
|
# The sizes the explorer's limits were measured against, so the numbers in
|
||||||
|
# EXPLORER.md can be taken again rather than re-derived. 32k is the largest
|
||||||
|
# the editor handles (EDIT_LIMIT); 128k is where typing loses characters;
|
||||||
|
# 1M is FILE_LIMIT, which the viewer reads fine and the editor refuses.
|
||||||
|
python3 - "$FILES" <<'FIXTURE'
|
||||||
|
import pathlib, sys
|
||||||
|
out = pathlib.Path(sys.argv[1])
|
||||||
|
block = """/// A doc comment on function number {i}, long enough that the scanner
|
||||||
|
/// has real comment spans to find rather than a token few.
|
||||||
|
fn generated_{i}(input: &str, count: u32) -> String {{
|
||||||
|
// an ordinary line comment
|
||||||
|
let mut out = String::from("prefix {i}: ");
|
||||||
|
for index in 0..count {{
|
||||||
|
out.push_str(&format!("{{}}-{{}}", index, input));
|
||||||
|
}}
|
||||||
|
out
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
for name, size in (("edit-32k.rs", 32 * 1024), ("edit-128k.rs", 128 * 1024),
|
||||||
|
("big-source.rs", 1024 * 1024)):
|
||||||
|
parts, written, i = [], 0, 0
|
||||||
|
while written < size - 400:
|
||||||
|
parts.append(block.format(i=i))
|
||||||
|
written += len(parts[-1])
|
||||||
|
i += 1
|
||||||
|
(out / name).write_text("".join(parts))
|
||||||
|
FIXTURE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$regen_config" ]; then
|
if [ -n "$regen_config" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user