Skip to content

Commit a0927d1

Browse files
committed
remoteLaunchers.ts: feed platform-specific data to tests
Use backward slashes on Windows and forward slashes on Unix-like OSes when testing correct behavior of path strings quotation.
1 parent 6df15dc commit a0927d1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/test/unittest/adapter/remoteLaunchers.unit.test.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
2-
// Licensed under the MIT License.
2+
// Licensed under the// MIT License.
33

44
'use strict';
55

@@ -8,18 +8,29 @@ import * as path from 'path';
88
import { EXTENSION_ROOT_DIR } from '../../../extension/common/constants';
99
import '../../../extension/common/promiseUtils';
1010
import * as launchers from '../../../extension/debugger/adapter/remoteLaunchers';
11+
import { getOSType, OSType } from '../../../extension/common/platform';
12+
13+
function osExpectedPath(windowsPath: string, unixPath: string): string {
14+
return getOSType() === OSType.Windows ? windowsPath : unixPath;
15+
}
1116

1217
suite('External debugpy Debugger Launcher', () => {
1318
[
1419
{
1520
testName: 'When path to debugpy does not contains spaces',
1621
path: path.join('path', 'to', 'debugpy'),
17-
expectedPath: 'path/to/debugpy',
22+
expectedPath: osExpectedPath(
23+
'path\\to\\debugpy',
24+
'path/to/debugpy'
25+
),
1826
},
1927
{
2028
testName: 'When path to debugpy contains spaces',
2129
path: path.join('path', 'to', 'debugpy', 'with spaces'),
22-
expectedPath: '"path/to/debugpy/with spaces"',
30+
expectedPath: osExpectedPath(
31+
'"path\\to\\debugpy\\with spaces"',
32+
'"path/to/debugpy/with spaces"'
33+
),
2334
},
2435
].forEach((testParams) => {
2536
suite(testParams.testName, async () => {

0 commit comments

Comments
 (0)