當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript TestStorageService.get方法代碼示例

本文整理匯總了TypeScript中vs/workbench/test/workbenchTestServices.TestStorageService.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TestStorageService.get方法的具體用法?TypeScript TestStorageService.get怎麽用?TypeScript TestStorageService.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/workbench/test/workbenchTestServices.TestStorageService的用法示例。


在下文中一共展示了TestStorageService.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: storeData

	function storeData(scope: StorageScope): void {
		const storage = new TestStorageService();

		strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, 'foobar'), 'foobar');
		strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, ''), '');
		strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, 5), 5);
		strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, 0), 0);
		strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, true), true);
		strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, false), false);

		storage.store('Monaco.IDE.Core.Storage.Test.get', 'foobar', scope);
		strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, void 0), 'foobar');

		storage.store('Monaco.IDE.Core.Storage.Test.get', '', scope);
		strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, void 0), '');

		storage.store('Monaco.IDE.Core.Storage.Test.getInteger', 5, scope);
		strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, void 0), 5);

		storage.store('Monaco.IDE.Core.Storage.Test.getInteger', 0, scope);
		strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, void 0), 0);

		storage.store('Monaco.IDE.Core.Storage.Test.getBoolean', true, scope);
		strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, void 0), true);

		storage.store('Monaco.IDE.Core.Storage.Test.getBoolean', false, scope);
		strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, void 0), false);

		strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.getDefault', scope, 'getDefault'), 'getDefault');
		strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getIntegerDefault', scope, 5), 5);
		strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBooleanDefault', scope, true), true);
	}
開發者ID:donaldpipowitch,項目名稱:vscode,代碼行數:32,代碼來源:storageService.test.ts

示例2: test

	test('Remove Data', () => {
		let storage = new TestStorageService();
		storage.store('Monaco.IDE.Core.Storage.Test.remove', 'foobar', StorageScope.GLOBAL);
		assert.strictEqual('foobar', storage.get('Monaco.IDE.Core.Storage.Test.remove', StorageScope.GLOBAL));

		storage.remove('Monaco.IDE.Core.Storage.Test.remove', StorageScope.GLOBAL);
		assert.ok(!storage.get('Monaco.IDE.Core.Storage.Test.remove', StorageScope.GLOBAL));
	});
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:8,代碼來源:storageService.test.ts

示例3: removeData

	function removeData(scope: StorageScope): void {
		const storage = new TestStorageService();

		storage.store('Monaco.IDE.Core.Storage.Test.remove', 'foobar', scope);
		strictEqual('foobar', storage.get('Monaco.IDE.Core.Storage.Test.remove', scope, void 0));

		storage.remove('Monaco.IDE.Core.Storage.Test.remove', scope);
		ok(!storage.get('Monaco.IDE.Core.Storage.Test.remove', scope, void 0));
	}
開發者ID:donaldpipowitch,項目名稱:vscode,代碼行數:9,代碼來源:storageService.test.ts


注:本文中的vs/workbench/test/workbenchTestServices.TestStorageService.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。