add test case

pull/3094/head
Iuri Matias 6 years ago
parent 018cef9534
commit cbeda1f3dc
  1. 11
      tests/examples_1/simple_storage_test.sol
  2. 6
      tests/testRunner.js

@ -1,5 +1,5 @@
pragma solidity ^0.4.7;
import "./tests.sol";
import "remix_tests.sol";
import "./simple_storage.sol";
contract MyTest {
@ -19,5 +19,14 @@ contract MyTest {
return foo.get() == 200;
}
function shouldTriggerOneFail() public {
Assert.equal(uint(1), uint(2), "the test 1 fails");
Assert.equal(uint(1), uint(2), "the test 2 fails");
}
function shouldTriggerOnePass() public {
Assert.equal(uint(1), uint(1), "the test 3 fails");
}
}

@ -43,16 +43,18 @@ describe('testRunner', function () {
})
it('should 1 passing test', function () {
assert.equal(results.passingNum, 1)
assert.equal(results.passingNum, 2)
})
it('should 1 failing test', function () {
assert.equal(results.failureNum, 1)
assert.equal(results.failureNum, 2)
})
it('should returns 3 messages', function () {
assert.deepEqual(tests, [
{ type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' },
{ type: 'testFailure', value: 'Should trigger one fail', time: 1, context: 'MyTest', errMsg: 'the test 1 fails' },
{ type: 'testPass', value: 'Should trigger one pass', time: 1, context: 'MyTest'},
{ type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' },
{ type: 'testFailure', value: 'Initial value should be200', time: 1, context: 'MyTest', errMsg: 'function returned false' }
])

Loading…
Cancel
Save