Skip to content

Commit 98eee6f

Browse files
committed
Update tests to support showReturnValue setting
1 parent cbb8745 commit 98eee6f

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/test/debugger/configProvider/provider.unit.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,9 @@ suite('Debugging - Config Provider', () => {
270270

271271
expect(debugConfig).to.have.property('console', 'integratedTerminal');
272272
expect(debugConfig).to.have.property('stopOnEntry', false);
273+
expect(debugConfig).to.have.property('showReturnValue', false);
273274
expect(debugConfig).to.have.property('debugOptions');
274-
expect((debugConfig as any).debugOptions).to.be.deep.equal(['RedirectOutput']);
275+
expect((debugConfig as any).debugOptions).to.be.deep.equal([DebugOptions.RedirectOutput]);
275276
});
276277
test('Test defaults of python debugger', async () => {
277278
if ('python' === DebuggerTypeName) {
@@ -286,6 +287,7 @@ suite('Debugging - Config Provider', () => {
286287
const debugConfig = await debugProvider.resolveDebugConfiguration!(workspaceFolder, {} as DebugConfiguration);
287288

288289
expect(debugConfig).to.have.property('stopOnEntry', false);
290+
expect(debugConfig).to.have.property('showReturnValue', false);
289291
expect(debugConfig).to.have.property('debugOptions');
290292
expect((debugConfig as any).debugOptions).to.be.deep.equal([DebugOptions.RedirectOutput]);
291293
});
@@ -300,6 +302,7 @@ suite('Debugging - Config Provider', () => {
300302

301303
expect(debugConfig).to.have.property('console', 'integratedTerminal');
302304
expect(debugConfig).to.have.property('stopOnEntry', false);
305+
expect(debugConfig).to.have.property('showReturnValue', false);
303306
expect(debugConfig).to.have.property('debugOptions');
304307
expect((debugConfig as any).debugOptions).to.be.deep.equal([]);
305308
});

src/test/debugger/misc.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ suite(`Standard Debugging - Misc tests: ${debuggerType}`, () => {
5656
return new DebugClientEx(testAdapterFilePath, debuggerType, coverageDirectory, { cwd: EXTENSION_ROOT_DIR });
5757
}
5858
}
59-
function buildLaunchArgs(pythonFile: string, stopOnEntry: boolean = false): LaunchRequestArguments {
59+
function buildLaunchArgs(pythonFile: string, stopOnEntry: boolean = false, showReturnValue: boolean = false): LaunchRequestArguments {
6060
const env = { PYTHONPATH: PTVSD_PATH };
6161
// tslint:disable-next-line:no-unnecessary-local-variable
6262
const options = {
6363
program: path.join(debugFilesPath, pythonFile),
6464
cwd: debugFilesPath,
6565
stopOnEntry,
66+
showReturnValue,
6667
debugOptions: [DebugOptions.RedirectOutput],
6768
pythonPath: PYTHON_PATH,
6869
args: [],

src/test/debugger/portAndHost.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ suite(`Standard Debugging of ports and hosts: ${debuggerType}`, () => {
4444
} catch (ex) { }
4545
});
4646

47-
function buildLauncArgs(pythonFile: string, stopOnEntry: boolean = false, port?: number, host?: string): LaunchRequestArguments {
47+
function buildLaunchArgs(pythonFile: string, stopOnEntry: boolean = false, port?: number, host?: string, showReturnValue: boolean = false): LaunchRequestArguments {
4848
return {
4949
program: path.join(debugFilesPath, pythonFile),
5050
cwd: debugFilesPath,
5151
stopOnEntry,
52+
showReturnValue,
5253
logToFile: true,
5354
debugOptions: [DebugOptions.RedirectOutput],
5455
pythonPath: PYTHON_PATH,
@@ -64,7 +65,7 @@ suite(`Standard Debugging of ports and hosts: ${debuggerType}`, () => {
6465
async function testDebuggingWithProvidedPort(port?: number | undefined, host?: string | undefined) {
6566
await Promise.all([
6667
debugClient.configurationSequence(),
67-
debugClient.launch(buildLauncArgs('startAndWait.py', false, port, host)),
68+
debugClient.launch(buildLaunchArgs('startAndWait.py', false, port, host)),
6869
debugClient.waitForEvent('initialized')
6970
]);
7071

src/test/debugger/run.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ suite('Run without Debugging', () => {
4040
} catch (ex) { }
4141
await sleep(1000);
4242
});
43-
function buildLauncArgs(pythonFile: string, stopOnEntry: boolean = false): LaunchRequestArguments {
43+
function buildLaunchArgs(pythonFile: string, stopOnEntry: boolean = false, showReturnValue: boolean = false): LaunchRequestArguments {
4444
// tslint:disable-next-line:no-unnecessary-local-variable
4545
return {
4646
program: path.join(debugFilesPath, pythonFile),
4747
cwd: debugFilesPath,
4848
stopOnEntry,
49+
showReturnValue,
4950
noDebug: true,
5051
debugOptions: [DebugOptions.RedirectOutput],
5152
pythonPath: PYTHON_PATH,
@@ -62,15 +63,15 @@ suite('Run without Debugging', () => {
6263
test('Should run program to the end', async () => {
6364
await Promise.all([
6465
debugClient.configurationSequence(),
65-
debugClient.launch(buildLauncArgs('simplePrint.py', false)),
66+
debugClient.launch(buildLaunchArgs('simplePrint.py', false)),
6667
debugClient.waitForEvent('initialized'),
6768
debugClient.waitForEvent('terminated')
6869
]);
6970
});
7071
test('test stderr output for Python', async () => {
7172
await Promise.all([
7273
debugClient.configurationSequence(),
73-
debugClient.launch(buildLauncArgs('stdErrOutput.py', false)),
74+
debugClient.launch(buildLaunchArgs('stdErrOutput.py', false)),
7475
debugClient.waitForEvent('initialized'),
7576
debugClient.assertOutput('stderr', 'error output'),
7677
debugClient.waitForEvent('terminated')
@@ -79,7 +80,7 @@ suite('Run without Debugging', () => {
7980
test('Test stdout output', async () => {
8081
await Promise.all([
8182
debugClient.configurationSequence(),
82-
debugClient.launch(buildLauncArgs('stdOutOutput.py', false)),
83+
debugClient.launch(buildLaunchArgs('stdOutOutput.py', false)),
8384
debugClient.waitForEvent('initialized'),
8485
debugClient.assertOutput('stdout', 'normal output'),
8586
debugClient.waitForEvent('terminated')
@@ -102,7 +103,7 @@ suite('Run without Debugging', () => {
102103
});
103104
await Promise.all([
104105
debugClient.configurationSequence(),
105-
debugClient.launch(buildLauncArgs('sampleWithSleep.py', false)),
106+
debugClient.launch(buildLaunchArgs('sampleWithSleep.py', false)),
106107
debugClient.waitForEvent('initialized'),
107108
processIdOutput
108109
]);

0 commit comments

Comments
 (0)