aboutsummaryrefslogtreecommitdiff
path: root/modules/test/test-parse-args.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/test/test-parse-args.js')
-rw-r--r--modules/test/test-parse-args.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/test/test-parse-args.js b/modules/test/test-parse-args.js
index 75fd7ab..f9836ae 100644
--- a/modules/test/test-parse-args.js
+++ b/modules/test/test-parse-args.js
@@ -51,6 +51,10 @@ ok('dispatchCommand takes rawText', /async dispatchCommand\(cmd, args, rawText\)
ok('module receives rawText', /mod\.commands\[cmd\]\(args, rawText\)/.test(termSrc));
ok('checkAndRun records raw input', /this\._currentRaw\s*=\s*rawInput/.test(termSrc));
ok('_dispatch forwards raw input', /dispatchCommand\(cmd, args, this\._currentRaw/.test(termSrc));
+// Pipes must forward each stage's own text too, otherwise splitPipe()'s raw stage is thrown
+// away by a second _parseArgs() pass and `js "a b".length | wc -c` sees `a b.length`.
+const chainSrc = termSrc.match(/async executePipeChain\(pipeParts\)\s*\{[\s\S]*?\n\s{12}\}/);
+ok('executePipeChain keeps the raw stage', !!chainSrc && /dispatchCommand\(cmd, args, pipeParts\[i\]/.test(chainSrc[0]), chainSrc ? 'no pipeParts[i] passthrough' : 'executePipeChain not found');
// ---- 3. console command uses the raw expression ---------------------------------------
const consoleSrc = fs.readFileSync(path.join(extDir, 'console.js'), 'utf8');