assertion events moved to separate file

pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent 0b06570d33
commit 41b07ed602
  1. 12
      libs/remix-tests/src/assertionEvents.ts
  2. 12
      libs/remix-tests/src/testRunner.ts
  3. 1
      libs/remix-tests/tests/examples_0/assert_lesserThan_test.sol

@ -0,0 +1,12 @@
const assertionEvents = [
{
name: 'AssertionEvent',
params: ['bool', 'string']
},
{
name: 'AssertionEventUint',
params: ['bool', 'string', 'uint256', 'uint256']
}
]
export default assertionEvents

@ -1,6 +1,7 @@
import async from 'async'
import * as changeCase from 'change-case'
import Web3 from 'web3';
import assertionEvents from './assertionEvents'
import { RunListInterface, TestCbInterface, TestResultInterface, ResultCbInterface,
CompiledContract, AstNode, Options, FunctionDescription, UserDocumentation } from './types'
@ -228,19 +229,8 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
method.send(sendParams).on('receipt', (receipt) => {
try {
const time: number = (Date.now() - startTime) / 1000.0
const assertionEvents = [
{
name: 'AssertionEvent',
params: ['bool', 'string']
},
{
name: 'AssertionEventUint',
params: ['bool', 'string', 'uint256', 'uint256']
}
]
const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')') )
let testPassed = false
for (const i in receipt.events) {
const event = receipt.events[i]
const eIndex = assertionEventHashes.indexOf(event.raw.topics[0]) // event name topic will always be at index 0

@ -1,4 +1,3 @@
import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertLesserThanTest {

Loading…
Cancel
Save