mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-04 22:54:33 +01:00
333d9a4053
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
28 lines
982 B
TypeScript
28 lines
982 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import { ITestingServicesAccessor } from '../../src/platform/test/node/services';
|
|
import { ISimulationTestRuntime } from './stest';
|
|
|
|
export function rubric(accessor: ITestingServicesAccessor, ...assertions: (() => void)[]) {
|
|
const runtime = accessor.get(ISimulationTestRuntime);
|
|
|
|
let passed = 0;
|
|
for (const a of assertions) {
|
|
try {
|
|
a();
|
|
passed++;
|
|
} catch (e) {
|
|
runtime.log(String(e));
|
|
// ignored
|
|
}
|
|
}
|
|
|
|
if (passed === 0) {
|
|
runtime.setOutcome({ kind: 'failed', hitContentFilter: false, error: 'no passed assertions', critical: false });
|
|
} else {
|
|
runtime.setExplicitScore(passed / assertions.length);
|
|
}
|
|
}
|