diff --git a/remix-tests/src/testRunner.ts b/remix-tests/src/testRunner.ts index 578ca2f5c7..37c3b6ae86 100644 --- a/remix-tests/src/testRunner.ts +++ b/remix-tests/src/testRunner.ts @@ -4,6 +4,12 @@ import Web3 from 'web3'; import { RunListInterface, TestCbInterface, TestResultInterface, ResultCbInterface, CompiledContract, AstNode, Options, FunctionDescription, UserDocumentation } from './types' +/** + * @dev Get function name using method signature + * @param signature siganture + * @param methodIdentifiers Object containing all methods identifier + */ + function getFunctionFullName (signature: string, methodIdentifiers: Record ): string | null { for (const method in methodIdentifiers) { if (signature.replace('0x', '') === methodIdentifiers[method].replace('0x', '')) { @@ -13,14 +19,31 @@ function getFunctionFullName (signature: string, methodIdentifiers: Record ): string | null { const fullName: string | null = getFunctionFullName(signature, methodIdentifiers) const senderRegex: RegExp = /#sender: account-+(\d)/g @@ -28,6 +51,13 @@ function getOverridedSender (userdoc: UserDocumentation, signature: string, meth return fullName && accountIndex ? accountIndex[1] : null } +/** + * @dev Get value provided using natspec + * @param userdoc method user documentaion + * @param signature signature + * @param methodIdentifiers Object containing all methods identifier + */ + function getProvidedValue (userdoc: UserDocumentation, signature: string, methodIdentifiers: Record ): string | null { const fullName: string | null = getFunctionFullName(signature, methodIdentifiers) const valueRegex: RegExp = /#value: (\d+)/g