v0.1.0 28f9d6e

ordinal_cases.mjs RawHistoryFolder

1// SPDX-License-Identifier: MIT
2//
3// Writes testdata/ordinal_cases.txt: for pairs of strings chosen around the
4// differences between .NET's OrdinalIgnoreCase and JavaScript's case mapping,
5// what the runner's `--cmp` mode answers (equality, ordering, IndexOf,
6// StartsWith, EndsWith). ordinal_test.go replays it.
7//
8//   dotnet build -c Release expr/gen/runner -p:RunnerSrc=<runner>/src/Sdk
9//   node expr/gen/runner/ordinal_cases.mjs > expr/testdata/ordinal_cases.txt
10
11import { writeFileSync, mkdtempSync, rmSync } from "node:fs";
12import { tmpdir } from "node:os";
13import { join } from "node:path";
14import { runDriver, here, checkEnvironment } from "./env.mjs";
15
16const words = [
17  "", "a", "A", "ab", "AB", "abc", "ABC", "Hello", "hELLO", "hello world", "true", "TRUE", "null",
18  "ß", "SS", "ss", "ẞ", "ʼn", "ʼN", "ffi", "FFI", "ffi", "ı", "I", "i", "İ", "ſ", "s", "S",
19  "\u212a", "k", "K", "\u212b", "å", "Å", "σ", "ς", "Σ", "ΑΣ", "ας", "ασ", "DŽ", "Dž", "dž", "Lj", "lj",
20  "é", "É", "e\u0301", "ÿ", "Ÿ", "µ", "μ", "Μ", "ǰ", "J\u030c", "ΐ", "ῼ", "ᾳ", "ᾼ",
21  "\u00e9", "\u00c9", "Dža", "DŽa", "Ж", "ж", "ა", "Ა", "ꭰ", "Ꭰ", "ᏸ", "Ᏸ", "ⓐ", "Ⓐ", "a", "A",
22  "\ue000", "\uffff", "\ud83d\ude00", "\ud801\udc00", "\ud801\udc28", "\u{10428}", "\ud800\udc00", "ab\ud83d\ude00", "AB\ud83d\ude00",
23  "x\u2028y", "x y", "x\u00a0y", "0", "00", "1e3", "-", "_", "a-b", "a_b", "[]", "'",
24];
25const hex = s => s.length ? [...s].flatMap(c => { const n = c.codePointAt(0); return n > 0xffff ? [0xd800 + ((n - 0x10000) >> 10), 0xdc00 + ((n - 0x10000) & 0x3ff)] : [n]; }).map(u => u.toString(16).toUpperCase()).join(".") : "-";
26const lines = [];
27for (const a of words) for (const b of words) lines.push(`${hex(a)} ${hex(b)}`);
28const tmp = mkdtempSync(join(tmpdir(), "ordinal-"));
29writeFileSync(join(tmp, "in.txt"), lines.join("\n") + "\n");
30const out = runDriver(["--cmp", join(tmp, "in.txt")]).split("\n").filter(Boolean);
31rmSync(tmp, { recursive: true });
32if (out.length !== lines.length) throw new Error("answer count");
33// Keep every pair that is interesting (some predicate true) and a sample of the rest, to bound the file.
34const res = [];
35lines.forEach((l, i) => {
36  const interesting = out[i] !== "0 0 0 0 0" && out[i] !== "0 -1 0 0 0" && out[i] !== "0 1 0 0 0";
37  if (interesting || i % 7 === 0) res.push(`${l} ${out[i]}`);
38});
39process.stdout.write(res.join("\n") + "\n");

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 3

↑↓ moveenter openesc close