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
6017b959
Commit
6017b959
authored
Nov 15, 2016
by
chriseth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and add tests.
parent
999b9193
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
9 deletions
+33
-9
package.json
package.json
+1
-1
gasCosts.js
src/app/staticanalysis/modules/gasCosts.js
+1
-1
staticanalysis.js
test-browser/tests/staticanalysis.js
+31
-7
No files found.
package.json
View file @
6017b959
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
"browser-test-remote-ie"
:
"nightwatch --config nightwatch.js --env ie"
,
"browser-test-remote-ie"
:
"nightwatch --config nightwatch.js --env ie"
,
"browser-test-remote-safari"
:
"nightwatch --config nightwatch.js --env safari"
,
"browser-test-remote-safari"
:
"nightwatch --config nightwatch.js --env safari"
,
"browser-test-remote-parallel"
:
"nightwatch --config nightwatch.js --env safari,ie,default,chrome"
,
"browser-test-remote-parallel"
:
"nightwatch --config nightwatch.js --env safari,ie,default,chrome"
,
"build"
:
"mkdir -p build; browserify src/index.js -g yo-yoify -o build/app.js; babel build/app.js -
s -
-out-file build/app.js"
,
"build"
:
"mkdir -p build; browserify src/index.js -g yo-yoify -o build/app.js; babel build/app.js --out-file build/app.js"
,
"csslint"
:
"csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='assets/css/font-awesome.min.css' assets/css/"
,
"csslint"
:
"csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='assets/css/font-awesome.min.css' assets/css/"
,
"downloadsolc"
:
"rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js"
,
"downloadsolc"
:
"rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js"
,
"lint"
:
"standard"
,
"lint"
:
"standard"
,
...
...
src/app/staticanalysis/modules/gasCosts.js
View file @
6017b959
...
@@ -19,7 +19,7 @@ gasCosts.prototype.report = function (compilationResults) {
...
@@ -19,7 +19,7 @@ gasCosts.prototype.report = function (compilationResults) {
if
(
fallback
===
null
||
fallback
>=
2100
)
{
if
(
fallback
===
null
||
fallback
>=
2100
)
{
report
.
push
({
report
.
push
({
warning
:
`Fallback function of contract
${
contractName
}
requires too much gas (
${
fallback
}
).\n
warning
:
`Fallback function of contract
${
contractName
}
requires too much gas (
${
fallback
}
).\n
If the fallback function requires
too much
gas, the contract cannot receive Ether.`
If the fallback function requires
more than 2300
gas, the contract cannot receive Ether.`
})
})
}
}
}
}
...
...
test-browser/tests/staticanalysis.js
View file @
6017b959
...
@@ -5,7 +5,13 @@ var sauce = require('./sauce')
...
@@ -5,7 +5,13 @@ var sauce = require('./sauce')
var
sources
=
{
var
sources
=
{
'sources'
:
{
'sources'
:
{
'Untitled'
:
`contract test1 { address test = tx.origin; } contract test2 {}`
'Untitled'
:
`
contract test1 { address test = tx.origin; }
contract test2 {}
contract TooMuchGas {
uint x;
function() { x++; }
}`
}
}
}
}
...
@@ -22,15 +28,33 @@ module.exports = {
...
@@ -22,15 +28,33 @@ module.exports = {
tearDown
:
sauce
tearDown
:
sauce
}
}
function
findText
(
browser
,
selector
,
textToFind
)
{
var
found
=
false
browser
.
elements
(
'css selector'
,
selector
,
function
(
warnings
)
{
warnings
.
value
.
forEach
(
function
(
warning
)
{
browser
.
elementIdText
(
warning
.
ELEMENT
,
function
(
text
)
{
if
(
text
.
indexOf
(
textToFind
)
>=
0
)
{
found
=
true
}
})
})
})
browser
.
assert
.
equal
(
found
,
true
)
}
function
runTests
(
browser
)
{
function
runTests
(
browser
)
{
browser
browser
.
waitForElementVisible
(
'.newFile'
,
10000
)
.
waitForElementVisible
(
'.newFile'
,
10000
)
contractHelper
.
testContracts
(
browser
,
sources
.
sources
.
Untitled
,
[
'test1'
,
'test2'
],
function
()
{
contractHelper
.
testContracts
(
browser
,
sources
.
sources
.
Untitled
,
[
'
TooMuchGas'
,
'
test1'
,
'test2'
],
function
()
{
browser
browser
.
click
(
'.staticanalysisView'
)
.
click
(
'.staticanalysisView'
)
.
click
(
'#staticanalysisView button'
)
.
click
(
'#staticanalysisView button'
)
.
waitForElementPresent
(
'#staticanalysisresult .warning'
)
.
waitForElementPresent
(
'#staticanalysisresult .warning'
)
.
assert
.
containsText
(
'#staticanalysisresult .warning pre'
,
'Untitled:1:33: use of tx.origin'
)
findText
(
browser
,
'#staticanalysisresult .warning span'
,
.
end
()
'Untitled:2:33: use of tx.origin'
)
findText
(
browser
,
'#staticanalysisresult .warning span'
,
'Fallback function of contract TooMuchGas requires too much gas'
)
browser
.
end
()
})
})
}
}
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