|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | 6 | import * as assert from 'assert'; |
7 | | -import { formatPII, getExactExpressionStartAndEnd } from 'vs/workbench/contrib/debug/common/debugUtils'; |
| 7 | +import { formatPII, getExactExpressionStartAndEnd, getVisibleAndSorted } from 'vs/workbench/contrib/debug/common/debugUtils'; |
| 8 | +import { IConfig } from 'vs/workbench/contrib/debug/common/debug'; |
8 | 9 |
|
9 | 10 | suite('Debug - Utils', () => { |
10 | 11 | test('formatPII', () => { |
@@ -37,4 +38,80 @@ suite('Debug - Utils', () => { |
37 | 38 | assert.deepEqual(getExactExpressionStartAndEnd('var t = a.b;c.d.name', 16, 20), { start: 13, end: 20 }); |
38 | 39 | assert.deepEqual(getExactExpressionStartAndEnd('var t = a.b.c-d.name', 16, 20), { start: 15, end: 20 }); |
39 | 40 | }); |
| 41 | + |
| 42 | + test('config presentation', () => { |
| 43 | + const configs: IConfig[] = []; |
| 44 | + configs.push({ |
| 45 | + type: 'node', |
| 46 | + request: 'launch', |
| 47 | + name: 'p' |
| 48 | + }); |
| 49 | + configs.push({ |
| 50 | + type: 'node', |
| 51 | + request: 'launch', |
| 52 | + name: 'a' |
| 53 | + }); |
| 54 | + configs.push({ |
| 55 | + type: 'node', |
| 56 | + request: 'launch', |
| 57 | + name: 'b', |
| 58 | + presentation: { |
| 59 | + hidden: false |
| 60 | + } |
| 61 | + }); |
| 62 | + configs.push({ |
| 63 | + type: 'node', |
| 64 | + request: 'launch', |
| 65 | + name: 'c', |
| 66 | + presentation: { |
| 67 | + hidden: true |
| 68 | + } |
| 69 | + }); |
| 70 | + configs.push({ |
| 71 | + type: 'node', |
| 72 | + request: 'launch', |
| 73 | + name: 'd', |
| 74 | + presentation: { |
| 75 | + group: '2_group', |
| 76 | + order: 5 |
| 77 | + } |
| 78 | + }); |
| 79 | + configs.push({ |
| 80 | + type: 'node', |
| 81 | + request: 'launch', |
| 82 | + name: 'e', |
| 83 | + presentation: { |
| 84 | + group: '2_group', |
| 85 | + order: 52 |
| 86 | + } |
| 87 | + }); |
| 88 | + configs.push({ |
| 89 | + type: 'node', |
| 90 | + request: 'launch', |
| 91 | + name: 'f', |
| 92 | + presentation: { |
| 93 | + group: '1_group', |
| 94 | + order: 500 |
| 95 | + } |
| 96 | + }); |
| 97 | + configs.push({ |
| 98 | + type: 'node', |
| 99 | + request: 'launch', |
| 100 | + name: 'g', |
| 101 | + presentation: { |
| 102 | + group: '5_group', |
| 103 | + order: 500 |
| 104 | + } |
| 105 | + }); |
| 106 | + |
| 107 | + const sorted = getVisibleAndSorted(configs); |
| 108 | + assert.equal(sorted.length, 7); |
| 109 | + assert.equal(sorted[0].name, 'f'); |
| 110 | + assert.equal(sorted[1].name, 'd'); |
| 111 | + assert.equal(sorted[2].name, 'e'); |
| 112 | + assert.equal(sorted[3].name, 'g'); |
| 113 | + assert.equal(sorted[4].name, 'b'); |
| 114 | + assert.equal(sorted[5].name, 'p'); |
| 115 | + assert.equal(sorted[6].name, 'a'); |
| 116 | + }); |
40 | 117 | }); |
0 commit comments