Skip to content

Commit 406c410

Browse files
committed
⚗️ Add tests to verify handling ITerm sequence: OSC 1337 ; CurrentDir=<Cwd> ST
Signed-off-by: Babak K. Shandiz <[email protected]>
1 parent 01d41e8 commit 406c410

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/vs/workbench/contrib/terminal/test/browser/xterm/shellIntegrationAddon.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,30 @@ suite('ShellIntegrationAddon', () => {
5858
await writeP(xterm, '\x1b]633;P;Cwd=/foo\x07');
5959
strictEqual(capabilities.has(TerminalCapability.CwdDetection), true);
6060
});
61+
6162
test('should pass cwd sequence to the capability', async () => {
6263
const mock = shellIntegrationAddon.getCwdDectionMock();
6364
mock.expects('updateCwd').once().withExactArgs('/foo');
6465
await writeP(xterm, '\x1b]633;P;Cwd=/foo\x07');
6566
mock.verify();
6667
});
6768

68-
suite('detect `SetCwd` sequence: `OSC 7; scheme://cwd ST`', async () => {
69+
test('detect ITerm sequence: `OSC 1337 ; CurrentDir=<Cwd> ST`', async () => {
70+
type TestCase = [title: string, input: string, expected: string];
71+
const cases: TestCase[] = [
72+
['root', '/', '/'],
73+
['non-root', '/some/path', '/some/path'],
74+
];
75+
for (const x of cases) {
76+
const [title, input, expected] = x;
77+
const mock = shellIntegrationAddon.getCwdDectionMock();
78+
mock.expects('updateCwd').once().withExactArgs(expected).named(title);
79+
await writeP(xterm, `\x1b]1337;CurrentDir=${input}\x07`);
80+
mock.verify();
81+
}
82+
});
6983

84+
suite('detect `SetCwd` sequence: `OSC 7; scheme://cwd ST`', async () => {
7085
test('should accept well-formatted URLs', async () => {
7186
type TestCase = [title: string, input: string, expected: string];
7287
const cases: TestCase[] = [

0 commit comments

Comments
 (0)