From e5250839dc4296a85591c700beffb7eb426d12f8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 9 May 2018 18:25:41 +0200 Subject: [PATCH] add test --- remix-lib/test/txFormat.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/remix-lib/test/txFormat.js b/remix-lib/test/txFormat.js index b6a908f124..3935ec8db1 100644 --- a/remix-lib/test/txFormat.js +++ b/remix-lib/test/txFormat.js @@ -1,6 +1,7 @@ 'use strict' var tape = require('tape') var txFormat = require('../src/execution/txFormat') +var txHelper = require('../src/execution/txHelper') var compiler = require('solc') var compilerInput = require('../src/helpers/compilerHelper').compilerInput var executionContext = require('../src/execution/execution-context') @@ -149,6 +150,17 @@ function encodeFunctionCallTest (st) { /* *********************************************************** */ +tape('test fallback function', function (t) { + t.test('(fallback)', function (st) { + st.plan(2) + var output = compiler.compileStandardWrapper(compilerInput(fallbackFunction)) + output = JSON.parse(output) + var contract = output.contracts['test.sol']['fallbackFunctionContract'] + st.equal(txHelper.encodeFunctionId(contract.abi[0]), '0x805da4ad') + st.equal(txHelper.encodeFunctionId(contract.abi[1]), '0x') + }) +}) + var uintContract = `contract uintContractTest { uint _tp; address _ap; @@ -186,3 +198,13 @@ contract testContractLinkLibrary { } }` + +var fallbackFunction = `pragma solidity ^0.4.4; + +contract fallbackFunctionContract { + function get (uint _p, string _o) { + + } + + function () {} + }`