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
ffe7ad4a
Commit
ffe7ad4a
authored
Jul 02, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix remix-analyzer tests
parent
2aaa47b2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
61 additions
and
32 deletions
+61
-32
index.ts
libs/remix-analyzer/src/solidity-analyzer/index.ts
+1
-1
abstractAstView.ts
...analyzer/src/solidity-analyzer/modules/abstractAstView.ts
+1
-1
staticAnalysisIntegration-test-0.4.24.ts
...er/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
+16
-11
staticAnalysisIntegration-test-0.5.0.ts
...zer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
+18
-9
staticAnalysisIssues-test-0.4.24.ts
...nalyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
+12
-5
staticAnalysisIssues-test-0.5.0.ts
...analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
+11
-4
tsconfig.json
libs/remix-analyzer/tsconfig.json
+2
-1
No files found.
libs/remix-analyzer/src/solidity-analyzer/index.ts
View file @
ffe7ad4a
'use strict'
'use strict'
import
{
AstWalker
}
from
'
@remix-project/
remix-astwalker'
import
{
AstWalker
}
from
'remix-astwalker'
import
list
from
'./modules/list'
import
list
from
'./modules/list'
import
{
CompilationResult
,
AnalyzerModule
,
AnalysisReportObj
,
AnalysisReport
}
from
'../types'
import
{
CompilationResult
,
AnalyzerModule
,
AnalysisReportObj
,
AnalysisReport
}
from
'../types'
...
...
libs/remix-analyzer/src/solidity-analyzer/modules/abstractAstView.ts
View file @
ffe7ad4a
import
{
getStateVariableDeclarationsFromContractNode
,
getInheritsFromName
,
getContractName
,
import
{
getStateVariableDeclarationsFromContractNode
,
getInheritsFromName
,
getContractName
,
getFunctionOrModifierDefinitionParameterPart
,
getType
,
getDeclaredVariableName
,
getFunctionDefinitionReturnParameterPart
}
from
'./staticAnalysisCommon'
getFunctionOrModifierDefinitionParameterPart
,
getType
,
getDeclaredVariableName
,
getFunctionDefinitionReturnParameterPart
}
from
'./staticAnalysisCommon'
import
{
AstWalker
}
from
'
@remix-project/
remix-astwalker'
import
{
AstWalker
}
from
'remix-astwalker'
import
{
FunctionDefinitionAstNode
,
ParameterListAstNode
,
ModifierDefinitionAstNode
,
ContractHLAst
,
VariableDeclarationAstNode
,
import
{
FunctionDefinitionAstNode
,
ParameterListAstNode
,
ModifierDefinitionAstNode
,
ContractHLAst
,
VariableDeclarationAstNode
,
FunctionHLAst
,
ReportObj
,
ReportFunction
,
VisitFunction
,
ModifierHLAst
,
CompilationResult
}
from
'../../types'
FunctionHLAst
,
ReportObj
,
ReportFunction
,
VisitFunction
,
ModifierHLAst
,
CompilationResult
}
from
'../../types'
...
...
libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
View file @
ffe7ad4a
import
*
as
test
from
"tape"
import
test
from
"tape"
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
readFileSync
}
from
'fs'
import
{
readFileSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
*
as
modules
from
'../../src/solidity-analyzer/modules/'
import
*
as
modules
from
'../../src/solidity-analyzer/modules/'
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
}
from
'../../src/types'
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
}
from
'../../src/types'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
import
solcOrg
from
'solc'
;
install
(
'solc@0.4.24'
)
const
solc
=
requireNPMmodule
(
'solc@0.4.24'
)
const
{
compilerInput
}
=
helpers
.
compiler
const
{
compilerInput
}
=
helpers
.
compiler
const
folder
:
string
=
'solidity-v0.4.24'
const
folder
:
string
=
'solidity-v0.4.24'
const
testFiles
:
string
[]
=
[
const
testFiles
:
string
[]
=
[
'KingOfTheEtherThrone.sol'
,
'KingOfTheEtherThrone.sol'
,
'assembly.sol'
,
'assembly.sol'
,
...
@@ -41,13 +38,21 @@ const testFiles: string[] = [
...
@@ -41,13 +38,21 @@ const testFiles: string[] = [
'forLoopIteratesOverDynamicArray.sol'
'forLoopIteratesOverDynamicArray.sol'
]
]
var
compilationResults
:
Record
<
string
,
CompilationResult
>
=
{}
let
compilationResults
:
Record
<
string
,
CompilationResult
>
=
{}
testFiles
.
forEach
((
fileName
)
=>
{
test
(
'setup'
,
function
(
t
:
test
.
Test
)
{
const
content
:
string
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
solcOrg
.
loadRemoteVersion
(
'v0.4.24+commit.e67f0147'
,
(
error
,
compiler
)
=>
{
// Latest AST is available under 'compileStandardWrapper' under solc for, 0.4.12 <= version < 0.5.0
if
(
error
)
throw
error
compilationResults
[
fileName
]
=
JSON
.
parse
(
solc
.
compileStandardWrapper
(
compilerInput
(
content
)))
})
testFiles
.
forEach
((
fileName
)
=>
{
const
content
:
string
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
// Latest AST is available under 'compileStandardWrapper' under solc for, 0.4.12 <= version < 0.5.0
compilationResults
[
fileName
]
=
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
})
t
.
end
()
})
});
test
(
'Integration test thisLocal module'
,
function
(
t
:
test
.
Test
)
{
test
(
'Integration test thisLocal module'
,
function
(
t
:
test
.
Test
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
...
...
libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
View file @
ffe7ad4a
import
*
as
test
from
"tape"
import
test
from
"tape"
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
readFileSync
}
from
'fs'
import
{
readFileSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
*
as
modules
from
'../../src/solidity-analyzer/modules/'
import
*
as
modules
from
'../../src/solidity-analyzer/modules/'
import
solc
from
'solc'
;
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
}
from
'../../src/types'
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
}
from
'../../src/types'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
install
(
'solc@0.5.0'
)
const
solc
=
requireNPMmodule
(
'solc@0.5.0'
)
const
{
compilerInput
}
=
helpers
.
compiler
const
{
compilerInput
}
=
helpers
.
compiler
const
folder
:
string
=
'solidity-v0.5'
const
folder
:
string
=
'solidity-v0.5'
...
@@ -40,12 +38,23 @@ const testFiles: string[] = [
...
@@ -40,12 +38,23 @@ const testFiles: string[] = [
'forLoopIteratesOverDynamicArray.sol'
'forLoopIteratesOverDynamicArray.sol'
]
]
var
compilationResults
:
Record
<
string
,
CompilationResult
>
=
{}
let
compilationResults
:
Record
<
string
,
CompilationResult
>
=
{}
test
(
'setup'
,
function
(
t
)
{
solc
.
loadRemoteVersion
(
'v0.5.0+commit.1d4f565a'
,
(
error
,
compiler
)
=>
{
if
(
error
)
throw
error
testFiles
.
forEach
((
fileName
)
=>
{
const
content
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
compilationResults
[
fileName
]
=
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
})
t
.
end
()
})
});
testFiles
.
forEach
((
fileName
)
=>
{
const
content
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
compilationResults
[
fileName
]
=
JSON
.
parse
(
solc
.
compile
(
compilerInput
(
content
)))
})
test
(
'Integration test thisLocal module'
,
function
(
t
:
test
.
Test
)
{
test
(
'Integration test thisLocal module'
,
function
(
t
:
test
.
Test
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
...
...
libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
View file @
ffe7ad4a
import
*
as
test
from
"tape"
import
test
from
"tape"
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
readFileSync
}
from
'fs'
import
{
readFileSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
solc
from
'solc'
;
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
,
AnalyzerModule
}
from
'../../src/types'
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
,
AnalyzerModule
}
from
'../../src/types'
import
{
checksEffectsInteraction
}
from
'../../src/solidity-analyzer/modules/'
import
{
checksEffectsInteraction
}
from
'../../src/solidity-analyzer/modules/'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
install
(
'solc@0.4.24'
)
const
compiler
=
requireNPMmodule
(
'solc@0.4.24'
)
const
{
compilerInput
}
=
helpers
.
compiler
const
{
compilerInput
}
=
helpers
.
compiler
const
folder
:
string
=
'solidity-v0.4.24'
const
folder
:
string
=
'solidity-v0.4.24'
let
compiler
test
(
'setup'
,
function
(
t
)
{
solc
.
loadRemoteVersion
(
'v0.4.24+commit.e67f0147'
,
(
error
,
solcVersion
)
=>
{
if
(
error
)
throw
error
compiler
=
solcVersion
t
.
end
()
})
});
function
compile
(
fileName
:
string
):
CompilationResult
{
function
compile
(
fileName
:
string
):
CompilationResult
{
const
content
:
string
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
const
content
:
string
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
return
JSON
.
parse
(
compiler
.
compile
StandardWrapper
(
compilerInput
(
content
)))
return
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
}
}
test
(
'staticAnalysisIssues.functionParameterPassingError'
,
function
(
t
)
{
test
(
'staticAnalysisIssues.functionParameterPassingError'
,
function
(
t
)
{
...
...
libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
View file @
ffe7ad4a
import
*
as
test
from
"tape"
import
test
from
"tape"
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
helpers
}
from
'@remix-project/remix-lib'
import
{
readFileSync
}
from
'fs'
import
{
readFileSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
{
default
as
StatRunner
}
from
'../../src/solidity-analyzer'
import
solc
from
'solc'
;
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
}
from
'../../src/types'
import
{
CompilationResult
,
AnalysisReportObj
,
AnalysisReport
}
from
'../../src/types'
import
{
checksEffectsInteraction
}
from
'../../src/solidity-analyzer/modules/'
import
{
checksEffectsInteraction
}
from
'../../src/solidity-analyzer/modules/'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
install
(
'solc@0.5.0'
)
const
compiler
=
requireNPMmodule
(
'solc@0.5.0'
)
const
{
compilerInput
}
=
helpers
.
compiler
const
{
compilerInput
}
=
helpers
.
compiler
const
folder
:
string
=
'solidity-v0.5'
const
folder
:
string
=
'solidity-v0.5'
let
compiler
test
(
'setup'
,
function
(
t
)
{
solc
.
loadRemoteVersion
(
'v0.5.0+commit.1d4f565a'
,
(
error
,
solcVersion
)
=>
{
if
(
error
)
throw
error
compiler
=
solcVersion
t
.
end
()
})
});
function
compile
(
fileName
):
CompilationResult
{
function
compile
(
fileName
):
CompilationResult
{
const
content
:
string
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
const
content
:
string
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
return
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
return
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
...
...
libs/remix-analyzer/tsconfig.json
View file @
ffe7ad4a
{
{
"extends"
:
"../../tsconfig.json"
,
"extends"
:
"../../tsconfig.json"
,
"compilerOptions"
:
{
"compilerOptions"
:
{
"types"
:
[
"node"
],
"types"
:
[
"node"
],
"module"
:
"commonjs"
,
"esModuleInterop"
:
true
,
"outDir"
:
"./dist"
,
},
},
"include"
:
[
"**/*.ts"
]
"include"
:
[
"**/*.ts"
]
}
}
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