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


TypeScript DebugClient.evaluateRequest方法代碼示例

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


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

示例1: it

	it('should inspect watches (evaluated while running) after running other evaluations', async function() {

		let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
		await util.setBreakpoints(dc, sourcePath, [ 25 ]);

		let evalResult = await dc.evaluateRequest({ expression: 'obj', context: 'watch' });

		await dc.evaluateRequest({ expression: 'obj.x', context: 'watch' });
		await dc.evaluateRequest({ expression: 'obj.y', context: 'repl' });

		let inspectResult = await dc.variablesRequest({ 
			variablesReference: evalResult.body.variablesReference
		});
		assert.equal(util.findVariable(inspectResult.body.variables, 'x').value, '17');
	});
開發者ID:hbenl,項目名稱:vscode-firefox-debug,代碼行數:15,代碼來源:testEvaluate.ts

示例2:

				dc.assertStoppedLocation('breakpoint', { path: PROGRAM, line: COND_BREAKPOINT_LINE } ).then(response => {
					const frame = response.body.stackFrames[0];
					return dc.evaluateRequest({ context: 'watch', frameId: frame.id, expression: 'x' }).then(response => {
						assert.equal(response.body.result, 9, 'x !== 9');
						return response;
					});
				})
開發者ID:abug,項目名稱:vscode-node-debug,代碼行數:7,代碼來源:adapter.test.ts

示例3: it

	it('should inspect variables from the stack after running evaluations', async function() {

		let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
		await util.setBreakpoints(dc, sourcePath, [ 8 ]);

		util.evaluate(dc, 'vars({foo:{bar:"baz"}})');
		let stoppedEvent = await util.receiveStoppedEvent(dc);
		let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });
		let frameId = stackTrace.body.stackFrames[0].id;
		let scopes = await dc.scopesRequest({ frameId });

		await dc.evaluateRequest({ expression: 'obj.x', context: 'watch', frameId });
		await dc.evaluateRequest({ expression: 'obj.y', context: 'repl', frameId });

		let variables = await dc.variablesRequest({ variablesReference: scopes.body.scopes[1].variablesReference });
		let arg = util.findVariable(variables.body.variables, 'arg');
		variables = await dc.variablesRequest({ variablesReference: arg.variablesReference });
		let foo = util.findVariable(variables.body.variables, 'foo');
		variables = await dc.variablesRequest({ variablesReference: foo.variablesReference });
		let bar = util.findVariable(variables.body.variables, 'bar');
		assert.equal(bar.value, '"baz"');
	});
開發者ID:hbenl,項目名稱:vscode-firefox-debug,代碼行數:22,代碼來源:testInspectVariables.ts


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