Skip to content

Commit d58a71d

Browse files
Add tests
1 parent 51b939c commit d58a71d

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/test/unittest/configuration/resolvers/attach.unit.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,5 +565,25 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
565565
expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult);
566566
});
567567
});
568+
569+
test('Send consoleName value to debugpy as consoleTitle', async () => {
570+
const activeFile = 'xyz.py';
571+
const consoleName = "My Console Name";
572+
const workspaceFolder = createMoqWorkspaceFolder(__dirname);
573+
setupActiveEditor(activeFile, PYTHON_LANGUAGE);
574+
const defaultWorkspace = path.join('usr', 'desktop');
575+
setupWorkspaces([defaultWorkspace]);
576+
577+
const debugOptions = debugOptionsAvailable
578+
.slice()
579+
.concat(DebugOptions.Jinja, DebugOptions.Sudo) as DebugOptions[];
580+
581+
const debugConfig = await resolveDebugConfiguration(workspaceFolder, {
582+
...attach,
583+
debugOptions,
584+
consoleName,
585+
});
586+
expect(debugConfig).to.have.property('consoleTitle', consoleName);
587+
});
568588
});
569589
});

src/test/unittest/configuration/resolvers/launch.unit.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,21 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
953953
});
954954
});
955955

956+
test('Send consoleName value to debugpy as consoleTitle', async () => {
957+
const consoleName = "My Console Name";
958+
const pythonPath = `PythonPath_${new Date().toString()}`;
959+
const workspaceFolder = createMoqWorkspaceFolder(__dirname);
960+
const pythonFile = 'xyz.py';
961+
setupIoc(pythonPath);
962+
setupActiveEditor(pythonFile, PYTHON_LANGUAGE);
963+
964+
const debugConfig = await resolveDebugConfiguration(workspaceFolder, {
965+
...launch,
966+
...{ consoleName }
967+
});
968+
expect(debugConfig).to.have.property('consoleTitle', consoleName);
969+
});
970+
956971
async function testSetting(
957972
requestType: 'launch' | 'attach',
958973
settings: Record<string, boolean>,

0 commit comments

Comments
 (0)