From f38e086bfdfd1f7632fc588b9bb0dc55e7ac3806 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 26 Nov 2015 13:02:05 +0100 Subject: [PATCH] debug: replHistory.test --- .../debug/test/common/replHistory.test.ts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/vs/workbench/parts/debug/test/common/replHistory.test.ts diff --git a/src/vs/workbench/parts/debug/test/common/replHistory.test.ts b/src/vs/workbench/parts/debug/test/common/replHistory.test.ts new file mode 100644 index 00000000000..1da7fe5b94e --- /dev/null +++ b/src/vs/workbench/parts/debug/test/common/replHistory.test.ts @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import assert = require('assert'); +import { ReplHistory } from 'vs/workbench/parts/debug/common/replHistory'; + +suite('Debug - Repl History', () => { + var history: ReplHistory; + + setup(() => { + history = new ReplHistory(['one', 'two', 'three', 'four', 'five']); + }); + + teardown(() => { + history = null; + }); + + test('previous and next', () => { + assert.equal(history.previous(), 'five'); + assert.equal(history.previous(), 'four'); + assert.equal(history.previous(), 'three'); + assert.equal(history.previous(), 'two'); + assert.equal(history.previous(), 'one'); + assert.equal(history.previous(), null); + assert.equal(history.next(), 'two'); + assert.equal(history.next(), 'three'); + assert.equal(history.next(), 'four'); + assert.equal(history.next(), 'five'); + }); + + test('evaluated and remember', () => { + history.evaluated('six'); + assert.equal(history.previous(), 'six'); + assert.equal(history.previous(), 'five'); + assert.equal(history.next(), 'six'); + + history.remember('six++', true); + assert.equal(history.next(), 'six++'); + assert.equal(history.previous(), 'six'); + + history.evaluated('seven'); + assert.equal(history.previous(), 'seven'); + assert.equal(history.previous(), 'six'); + }); +});