Add tests for --help

This commit is contained in:
Daniel Imms
2016-07-06 20:06:07 -07:00
parent 6676207fb3
commit 06bc987651
2 changed files with 48 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import assert = require('assert');
import {formatOptions} from 'vs/code/node/argv';
suite('formatOptions', () => {
test('Text should display small columns correctly', () => {
assert.equal(formatOptions({'foo': 'bar'}, 80), ' foo bar');
assert.equal(
formatOptions({
'f': 'bar',
'fo': 'ba',
'foo': 'b'
}, 80),
' f bar\n' +
' fo ba\n' +
' foo b');
});
test('Text should wrap', () => {
assert.equal(
formatOptions({
'foo': (<any>'bar ').repeat(9)
}, 40),
' foo bar bar bar bar bar bar bar bar\n' +
' bar');
});
test('Text should revert to the condensed view when the terminal is too narrow', () => {
assert.equal(
formatOptions({
'foo': (<any>'bar ').repeat(9)
}, 30),
' foo\n' +
' bar bar bar bar bar bar bar bar bar ');
});
});