Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
a5aa8cdc
Commit
a5aa8cdc
authored
Dec 02, 2020
by
aniket-engg
Committed by
Aniket
Dec 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remix-lib tests working fine
parent
8b521cef
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
53 deletions
+54
-53
execution-context.ts
libs/remix-lib/src/execution/execution-context.ts
+1
-1
eventManager.ts
libs/remix-lib/test/eventManager.ts
+8
-8
tests.ts
libs/remix-lib/test/tests.ts
+5
-5
txFormat.ts
libs/remix-lib/test/txFormat.ts
+11
-10
txHelper.ts
libs/remix-lib/test/txHelper.ts
+2
-2
txResultHelper.ts
libs/remix-lib/test/txResultHelper.ts
+3
-4
util.ts
libs/remix-lib/test/util.ts
+2
-2
tsconfig.lib.json
libs/remix-lib/tsconfig.lib.json
+15
-14
workspace.json
workspace.json
+7
-7
No files found.
libs/remix-lib/src/execution/execution-context.ts
View file @
a5aa8cdc
...
@@ -7,7 +7,7 @@ import { Web3VmProvider } from '../web3Provider/web3VmProvider'
...
@@ -7,7 +7,7 @@ import { Web3VmProvider } from '../web3Provider/web3VmProvider'
const
EthJSVM
=
require
(
'ethereumjs-vm'
).
default
const
EthJSVM
=
require
(
'ethereumjs-vm'
).
default
const
StateManager
=
require
(
'ethereumjs-vm/dist/state/stateManager'
).
default
const
StateManager
=
require
(
'ethereumjs-vm/dist/state/stateManager'
).
default
const
LogsManager
=
require
(
'./logsManager.js'
)
import
{
LogsManager
}
from
'./logsManager'
declare
let
ethereum
:
any
declare
let
ethereum
:
any
let
web3
let
web3
...
...
libs/remix-lib/test/eventManager.ts
View file @
a5aa8cdc
'use strict'
'use strict'
const
tape
=
require
(
'tape'
)
import
tape
from
'tape'
const
EventManager
=
require
(
'../src/eventManager'
)
import
{
EventManager
}
from
'../src/eventManager'
tape
(
'eventManager'
,
function
(
t
)
{
tape
(
'eventManager'
,
function
(
t
)
{
t
.
test
(
'eventManager'
,
function
(
st
)
{
t
.
test
(
'eventManager'
,
function
(
st
)
{
const
events
=
new
EventManager
()
const
events
=
new
EventManager
()
const
listenner
=
{}
const
listenner
=
{}
let
trace
=
''
let
trace
=
''
listenner
.
listen
=
function
(
data1
)
{
listenner
[
'listen'
]
=
function
(
data1
)
{
trace
+=
data1
trace
+=
data1
}
}
const
registeredFunction
=
function
(
data
)
{
const
registeredFunction
=
function
(
data
)
{
trace
+=
data
trace
+=
data
}
}
events
.
register
(
'event1'
,
listenner
,
listenner
.
listen
)
events
.
register
(
'event1'
,
listenner
,
listenner
[
'listen'
]
)
events
.
register
(
'event2'
,
registeredFunction
)
events
.
register
(
'event2'
,
registeredFunction
,
null
)
events
.
trigger
(
'event1'
,
[
'event1'
])
events
.
trigger
(
'event1'
,
[
'event1'
])
events
.
trigger
(
'event2'
,
[
'event2'
])
events
.
trigger
(
'event2'
,
[
'event2'
])
st
.
equal
(
trace
,
'event1event2'
)
st
.
equal
(
trace
,
'event1event2'
)
events
.
unregister
(
'event1'
,
listenner
.
listen
)
events
.
unregister
(
'event1'
,
listenner
[
'listen'
],
null
)
st
.
equal
(
events
.
registered
[
'event1'
].
length
,
1
)
st
.
equal
(
events
.
registered
[
'event1'
].
length
,
1
)
st
.
equal
(
events
.
registered
[
'event2'
].
length
,
1
)
st
.
equal
(
events
.
registered
[
'event2'
].
length
,
1
)
events
.
unregister
(
'event1'
,
listenner
,
listenner
.
listen
)
events
.
unregister
(
'event1'
,
listenner
,
listenner
[
'listen'
]
)
st
.
equal
(
events
.
registered
[
'event1'
].
length
,
0
)
st
.
equal
(
events
.
registered
[
'event1'
].
length
,
0
)
st
.
equal
(
events
.
registered
[
'event2'
].
length
,
1
)
st
.
equal
(
events
.
registered
[
'event2'
].
length
,
1
)
events
.
unregister
(
'event2'
,
registeredFunction
)
events
.
unregister
(
'event2'
,
registeredFunction
,
null
)
st
.
equal
(
events
.
registered
[
'event1'
].
length
,
0
)
st
.
equal
(
events
.
registered
[
'event1'
].
length
,
0
)
st
.
equal
(
events
.
registered
[
'event2'
].
length
,
0
)
st
.
equal
(
events
.
registered
[
'event2'
].
length
,
0
)
st
.
end
()
st
.
end
()
...
...
libs/remix-lib/test/tests.ts
View file @
a5aa8cdc
require
(
'./eventManager.
j
s'
)
require
(
'./eventManager.
t
s'
)
require
(
'./util.
j
s'
)
require
(
'./util.
t
s'
)
require
(
'./txFormat.
j
s'
)
require
(
'./txFormat.
t
s'
)
require
(
'./txHelper.
j
s'
)
require
(
'./txHelper.
t
s'
)
require
(
'./txResultHelper.
j
s'
)
require
(
'./txResultHelper.
t
s'
)
libs/remix-lib/test/txFormat.ts
View file @
a5aa8cdc
'use strict'
'use strict'
import
*
as
tape
from
'tape'
import
tape
from
'tape'
const
txFormat
=
require
(
'../src/execution/txFormat'
)
import
*
as
txFormat
from
'../src/execution/txFormat'
const
txHelper
=
require
(
'../src/execution/txHelper'
)
import
*
as
txHelper
from
'../src/execution/txHelper'
const
util
=
require
(
'../src/util'
)
import
{
hexToIntArray
}
from
'../src/util'
let
compiler
=
require
(
'solc'
)
let
compiler
=
require
(
'solc'
)
const
compilerInput
=
require
(
'../src/helpers/compilerHelper'
).
compilerInput
import
{
compilerInput
}
from
'../src/helpers/compilerHelper'
const
executionContext
=
require
(
'../'
).
execution
.
executionContext
import
{
ExecutionContext
}
from
'../src/execution/execution-context'
const
executionContext
=
new
ExecutionContext
()
const
solidityVersion
=
'v0.6.0+commit.26b70077'
const
solidityVersion
=
'v0.6.0+commit.26b70077'
/* tape *********************************************************** */
/* tape *********************************************************** */
...
@@ -150,7 +151,7 @@ function testInvalidTupleInput (st, params) {
...
@@ -150,7 +151,7 @@ function testInvalidTupleInput (st, params) {
/* tape *********************************************************** */
/* tape *********************************************************** */
tape
(
'ContractParameters - (TxFormat.buildData) - link Libraries'
,
function
(
t
)
{
tape
(
'ContractParameters - (TxFormat.buildData) - link Libraries'
,
function
(
t
)
{
executionContext
.
setContext
(
'vm'
)
executionContext
.
setContext
(
'vm'
,
null
,
null
,
null
)
const
compileData
=
compiler
.
compile
(
compilerInput
(
deploySimpleLib
))
const
compileData
=
compiler
.
compile
(
compilerInput
(
deploySimpleLib
))
const
fakeDeployedContracts
=
{
const
fakeDeployedContracts
=
{
...
@@ -293,7 +294,7 @@ tape('test abiEncoderV2', function (t) {
...
@@ -293,7 +294,7 @@ tape('test abiEncoderV2', function (t) {
console
.
log
(
error
)
console
.
log
(
error
)
st
.
equal
(
encoded
.
dataHex
,
functionId
+
encodedData
.
replace
(
'0x'
,
''
))
st
.
equal
(
encoded
.
dataHex
,
functionId
+
encodedData
.
replace
(
'0x'
,
''
))
})
})
let
decoded
=
txFormat
.
decodeResponse
(
util
.
hexToIntArray
(
encodedData
),
contract
.
abi
[
0
])
let
decoded
=
txFormat
.
decodeResponse
(
hexToIntArray
(
encodedData
),
contract
.
abi
[
0
])
console
.
log
(
decoded
)
console
.
log
(
decoded
)
st
.
equal
(
decoded
[
0
],
`tuple(uint256,uint256,string):
${
value1
}
,
${
value2
}
,
${
value3
}
`
)
st
.
equal
(
decoded
[
0
],
`tuple(uint256,uint256,string):
${
value1
}
,
${
value2
}
,
${
value3
}
`
)
})
})
...
@@ -314,14 +315,14 @@ tape('test abiEncoderV2 array of tuple', function (t) {
...
@@ -314,14 +315,14 @@ tape('test abiEncoderV2 array of tuple', function (t) {
const
contract
=
output
.
contracts
[
'test.sol'
][
'test'
]
const
contract
=
output
.
contracts
[
'test.sol'
][
'test'
]
txFormat
.
encodeParams
(
'[34, "test"]'
,
contract
.
abi
[
1
],
(
error
,
encoded
)
=>
{
txFormat
.
encodeParams
(
'[34, "test"]'
,
contract
.
abi
[
1
],
(
error
,
encoded
)
=>
{
console
.
log
(
error
)
console
.
log
(
error
)
const
decoded
=
txFormat
.
decodeResponse
(
util
.
hexToIntArray
(
encoded
.
dataHex
),
contract
.
abi
[
1
])
const
decoded
=
txFormat
.
decodeResponse
(
hexToIntArray
(
encoded
.
dataHex
),
contract
.
abi
[
1
])
console
.
log
(
decoded
)
console
.
log
(
decoded
)
st
.
equal
(
decoded
[
0
],
'tuple(uint256,string): _strucmts 34,test'
)
st
.
equal
(
decoded
[
0
],
'tuple(uint256,string): _strucmts 34,test'
)
})
})
txFormat
.
encodeParams
(
'[[34, "test"], [123, "test2"]]'
,
contract
.
abi
[
2
],
(
error
,
encoded
)
=>
{
txFormat
.
encodeParams
(
'[[34, "test"], [123, "test2"]]'
,
contract
.
abi
[
2
],
(
error
,
encoded
)
=>
{
console
.
log
(
error
)
console
.
log
(
error
)
const
decoded
=
txFormat
.
decodeResponse
(
util
.
hexToIntArray
(
encoded
.
dataHex
),
contract
.
abi
[
2
])
const
decoded
=
txFormat
.
decodeResponse
(
hexToIntArray
(
encoded
.
dataHex
),
contract
.
abi
[
2
])
console
.
log
(
decoded
)
console
.
log
(
decoded
)
st
.
equal
(
decoded
[
0
],
'tuple(uint256,string)[]: strucmts 34,test,123,test2'
)
st
.
equal
(
decoded
[
0
],
'tuple(uint256,string)[]: strucmts 34,test,123,test2'
)
})
})
...
...
libs/remix-lib/test/txHelper.ts
View file @
a5aa8cdc
'use strict'
'use strict'
const
tape
=
require
(
'tape'
)
import
tape
from
'tape'
const
txHelper
=
require
(
'../src/execution/txHelper'
)
import
*
as
txHelper
from
'../src/execution/txHelper'
tape
(
'getFunction'
,
function
(
st
)
{
tape
(
'getFunction'
,
function
(
st
)
{
st
.
plan
(
6
)
st
.
plan
(
6
)
...
...
libs/remix-lib/test/txResultHelper.ts
View file @
a5aa8cdc
'use strict'
'use strict'
const
tape
=
require
(
'tape'
)
import
tape
from
'tape'
const
{
BN
,
toBuffer
}
=
require
(
'ethereumjs-util'
)
import
{
BN
,
toBuffer
}
from
'ethereumjs-util'
import
{
resultToRemixTx
}
from
'../src/helpers/txResultHelper'
const
{
resultToRemixTx
}
=
require
(
'../src/helpers/txResultHelper'
)
const
TRANSACTION_HASH
=
'0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e'
const
TRANSACTION_HASH
=
'0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e'
const
CONTRACT_ADDRESS_HEX
=
'0x692a70d2e424a56d2c6c27aa97d1a86395877b3a'
const
CONTRACT_ADDRESS_HEX
=
'0x692a70d2e424a56d2c6c27aa97d1a86395877b3a'
...
...
libs/remix-lib/test/util.ts
View file @
a5aa8cdc
'use strict'
'use strict'
const
tape
=
require
(
'tape'
)
import
tape
from
'tape'
const
util
=
require
(
'../src/util'
)
import
*
as
util
from
'../src/util'
tape
(
'Util'
,
function
(
t
)
{
tape
(
'Util'
,
function
(
t
)
{
t
.
test
(
'lowerbound'
,
function
(
st
)
{
t
.
test
(
'lowerbound'
,
function
(
st
)
{
...
...
libs/remix-lib/tsconfig.lib.json
View file @
a5aa8cdc
{
{
"extends"
:
"../../tsconfig.json"
,
"extends"
:
"../../tsconfig.json"
,
"compilerOptions"
:
{
"compilerOptions"
:
{
"module"
:
"commonjs"
,
"module"
:
"commonjs"
,
"outDir"
:
"../../dist/out-tsc"
,
"outDir"
:
"../../dist/out-tsc"
,
"declaration"
:
true
,
"declaration"
:
true
,
"rootDir"
:
"./"
,
"rootDir"
:
"./"
,
"types"
:
[
"node"
,
"tape"
]
"types"
:
[
"node"
,
"tape"
]
},
},
"exclude"
:
[
"exclude"
:
[
"**/*.spec.js"
,
"**/*.spec.js"
,
"test/"
"test/"
],
],
"include"
:
[
"**/*.ts"
]
"include"
:
[
"**/*.ts"
]
}
}
\ No newline at end of file
workspace.json
View file @
a5aa8cdc
...
@@ -128,7 +128,7 @@
...
@@ -128,7 +128,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-analyzer"
"cwd"
:
"libs/remix-analyzer"
}
}
},
},
...
@@ -162,7 +162,7 @@
...
@@ -162,7 +162,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-astwalker"
"cwd"
:
"libs/remix-astwalker"
}
}
},
},
...
@@ -196,7 +196,7 @@
...
@@ -196,7 +196,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-debug"
"cwd"
:
"libs/remix-debug"
}
}
},
},
...
@@ -241,7 +241,7 @@
...
@@ -241,7 +241,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-lib"
"cwd"
:
"libs/remix-lib"
}
}
},
},
...
@@ -275,7 +275,7 @@
...
@@ -275,7 +275,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-simulator"
"cwd"
:
"libs/remix-simulator"
}
}
},
},
...
@@ -320,7 +320,7 @@
...
@@ -320,7 +320,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-solidity"
"cwd"
:
"libs/remix-solidity"
}
}
},
},
...
@@ -402,7 +402,7 @@
...
@@ -402,7 +402,7 @@
"test"
:
{
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"options"
:
{
"commands"
:
[
"npm-run-all test"
],
"commands"
:
[
"
./../../node_modules/.bin/
npm-run-all test"
],
"cwd"
:
"libs/remix-url-resolver"
"cwd"
:
"libs/remix-url-resolver"
}
}
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment