diff --git a/app/ui-sandbox.sh b/app/ui-sandbox.sh index 1bd3044..bde9a43 100755 --- a/app/ui-sandbox.sh +++ b/app/ui-sandbox.sh @@ -281,6 +281,33 @@ chmod 000 "$FILES/unreadable.txt" printf 'in a subdirectory\n' >"$FILES/sub/inside.txt" ln -sfn sub "$FILES/link-to-sub" 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 if [ -n "$regen_config" ]; then