An original short-tag test-case record with requirements, setup, commands, expected results and actual boundary/error executions

HTML for this example

Select the code and use your copy shortcut. Changes in this preview are temporary.

<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; form-action 'none'; base-uri 'none'"><title>Short-tag test-case record</title><style>*{box-sizing:border-box}body{margin:0;font:16px/1.5 Arial,Helvetica,sans-serif;color:#24313b;background:#fff}main{max-width:900px;margin:auto;padding:22px}h1{font-size:26px;line-height:1.2;margin:8px 0 18px}h2{font-size:19px;margin:22px 0 10px}h3{font-size:17px;margin:14px 0 8px}p{margin:10px 0}ul,ol{padding-left:22px}li{margin:6px 0}.note{font-size:13px;color:#53616a}.callout{border-left:4px solid #405d73;background:#f2f5f7;padding:10px 14px}table{border-collapse:collapse;width:100%;margin:12px 0}caption{text-align:left;font-weight:bold;padding:0 0 8px}th,td{padding:9px 8px;text-align:left;vertical-align:top;border-bottom:1px solid #b8c3ca;overflow-wrap:anywhere}th{background:#edf2f5}td b{display:none}footer{border-top:1px solid #aeb9bf;margin-top:22px;padding-top:12px}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:16px/1.5 ui-monospace,monospace;background:#f5f5f5;padding:12px}@media(max-width:560px){main{padding:16px}h1{font-size:23px}thead{display:none}table,tbody,tr,td{display:block;width:100%}caption{display:block}tr{border-bottom:1px solid #aeb9bf;padding:6px 0}td{border:0;padding:3px 0}td b{display:inline}}@media print{@page{size:letter;margin:.5in}main{padding:0}}table th:first-child{width:110px}table pre{font-size:14px;background:transparent;padding:0;margin:0}code{overflow-wrap:anywhere}</style></head><body><main><p class="note">Original teaching script • actual local execution, not a deployed product</p><h1>Short-tag: repeatable test cases</h1><p data-environment>Observed environment: Node v24.11.0 on win32. Save the supplied source as short-tag.mjs. No packages, file operations or network access.</p><h2>Requirement and setup</h2><p data-contract>TAG-1: exactly one argument, one through eight ASCII lowercase letters. TAG-2: a wrong argument count is a usage error. No trimming, case conversion or Unicode normalization.</p><pre data-command>node short-tag.mjs a
Accepted: a</pre><h2>Output and error rules</h2><table><caption>Streams and exit codes are distinct</caption><thead><tr><th scope="col">Condition</th><th scope="col">Output stream / text</th><th scope="col">Exit</th></tr></thead><tbody><tr data-rule="success"><td><b>Condition: </b>Accepted value</td><td><b>Output stream / text: </b>stdout: Accepted: unchanged value</td><td><b>Exit: </b>0</td></tr><tr data-rule="format"><td><b>Condition: </b>Invalid content</td><td><b>Output stream / text: </b>stderr: Invalid tag</td><td><b>Exit: </b>1</td></tr><tr data-rule="usage"><td><b>Condition: </b>Missing / extra arguments</td><td><b>Output stream / text: </b>stderr: Usage: node short-tag.mjs TAG</td><td><b>Exit: </b>1</td></tr></tbody></table><h2>Executed cases</h2><p data-observation>These eight commands were actually run against the supplied source. PASS means the case matched its expectation; an expected error can pass. Every case is independent: save this source, then run its listed command in Node.</p><table><caption>Expected versus actual output; empty stream shown as an empty string</caption><thead><tr><th scope="col">Case / requirement</th><th scope="col">Action</th><th scope="col">Expected</th><th scope="col">Actual</th><th scope="col">Case status</th></tr></thead><tbody><tr data-case="TC-01" data-requirement="TAG-1" data-exit="0"><td><b>Case / requirement: </b>TC-01 · TAG-1</td><td><b>Action: </b><code>node short-tag.mjs "a"</code></td><td><b>Expected: </b><pre>{"exit":0,"stdout":"Accepted: a\n","stderr":""}</pre></td><td><b>Actual: </b><pre>{"exit":0,"stdout":"Accepted: a\n","stderr":""}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-02" data-requirement="TAG-1" data-exit="0"><td><b>Case / requirement: </b>TC-02 · TAG-1</td><td><b>Action: </b><code>node short-tag.mjs "abcdefgh"</code></td><td><b>Expected: </b><pre>{"exit":0,"stdout":"Accepted: abcdefgh\n","stderr":""}</pre></td><td><b>Actual: </b><pre>{"exit":0,"stdout":"Accepted: abcdefgh\n","stderr":""}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-03" data-requirement="TAG-1" data-exit="1"><td><b>Case / requirement: </b>TC-03 · TAG-1</td><td><b>Action: </b><code>node short-tag.mjs ""</code></td><td><b>Expected: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Actual: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-04" data-requirement="TAG-1" data-exit="1"><td><b>Case / requirement: </b>TC-04 · TAG-1</td><td><b>Action: </b><code>node short-tag.mjs "abcdefghi"</code></td><td><b>Expected: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Actual: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-05" data-requirement="TAG-1" data-exit="1"><td><b>Case / requirement: </b>TC-05 · TAG-1</td><td><b>Action: </b><code>node short-tag.mjs "A"</code></td><td><b>Expected: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Actual: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-06" data-requirement="TAG-1" data-exit="1"><td><b>Case / requirement: </b>TC-06 · TAG-1</td><td><b>Action: </b><code>node short-tag.mjs "a1"</code></td><td><b>Expected: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Actual: </b><pre>{"exit":1,"stdout":"","stderr":"Invalid tag\n"}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-07" data-requirement="TAG-2" data-exit="1"><td><b>Case / requirement: </b>TC-07 · TAG-2</td><td><b>Action: </b><code>node short-tag.mjs</code></td><td><b>Expected: </b><pre>{"exit":1,"stdout":"","stderr":"Usage: node short-tag.mjs TAG\n"}</pre></td><td><b>Actual: </b><pre>{"exit":1,"stdout":"","stderr":"Usage: node short-tag.mjs TAG\n"}</pre></td><td><b>Case status: </b>PASS</td></tr><tr data-case="TC-08" data-requirement="TAG-2" data-exit="1"><td><b>Case / requirement: </b>TC-08 · TAG-2</td><td><b>Action: </b><code>node short-tag.mjs "a" "b"</code></td><td><b>Expected: </b><pre>{"exit":1,"stdout":"","stderr":"Usage: node short-tag.mjs TAG\n"}</pre></td><td><b>Actual: </b><pre>{"exit":1,"stdout":"","stderr":"Usage: node short-tag.mjs TAG\n"}</pre></td><td><b>Case status: </b>PASS</td></tr></tbody></table><h2>Complete original source</h2><pre data-source>const args = process.argv.slice(2);
if (args.length !== 1) {
  console.error("Usage: node short-tag.mjs TAG");
  process.exit(1);
}
const value = args[0];
if (!new RegExp("^[a-z]{1,8}$").test(value)) {
  console.error("Invalid tag");
  process.exit(1);
}
console.log("Accepted: " + value);
</pre><footer><h2>Reproduce before changing the record</h2><p data-boundary>A new run against a different build starts with actual results blank and status Not run. Use Blocked only for a missing prerequisite; no release approval, tester identity or bug ID is supplied.</p><p>Ask another developer or tester to repeat the boundary and argument-count cases from the same source. Record any new result in the actual repository or test tool; this reading copy does not run commands.</p></footer></main></body></html>