Update inconsistent support message

This commit is contained in:
Koen Vlaswinkel
2023-12-15 14:47:07 +01:00
parent d036e8144d
commit 0b4fc76fdb
2 changed files with 8 additions and 17 deletions

View File

@@ -4,11 +4,7 @@ import { BaseLogger } from "../common/logging";
interface Notifier { interface Notifier {
missingMethod(signature: string): void; missingMethod(signature: string): void;
inconsistentSupported( inconsistentSupported(signature: string, expectedSupported: boolean): void;
signature: string,
expectedSupported: boolean,
actualSupported: boolean,
): void;
} }
export function checkConsistency( export function checkConsistency(
@@ -48,11 +44,7 @@ function checkMethodConsistency(
); );
if (method.supported !== expectSupported) { if (method.supported !== expectSupported) {
notifier.inconsistentSupported( notifier.inconsistentSupported(method.signature, expectSupported);
method.signature,
expectSupported,
method.supported,
);
} }
} }
@@ -65,13 +57,13 @@ export class DefaultNotifier implements Notifier {
); );
} }
inconsistentSupported( inconsistentSupported(signature: string, expectedSupported: boolean) {
signature: string, const expectedMessage = expectedSupported
expectedSupported: boolean, ? `Expected method to be supported, but it is not.`
actualSupported: boolean, : `Expected method to not be supported, but it is.`;
) {
void this.logger.log( void this.logger.log(
`Model editor query consistency check: Inconsistent supported flag for method ${signature}. Expected supported: ${expectedSupported}, actual supported: ${actualSupported}.`, `Model editor query consistency check: Inconsistent supported flag for method ${signature}. ${expectedMessage}`,
); );
} }
} }

View File

@@ -52,7 +52,6 @@ describe("checkConsistency", () => {
expect(notifier.inconsistentSupported).toHaveBeenCalledWith( expect(notifier.inconsistentSupported).toHaveBeenCalledWith(
"Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SeparatedList`1(System.Collections.Generic.IEnumerable<TNode>)", "Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SeparatedList`1(System.Collections.Generic.IEnumerable<TNode>)",
true, true,
false,
); );
expect(notifier.missingMethod).not.toHaveBeenCalled(); expect(notifier.missingMethod).not.toHaveBeenCalled();
}); });