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
1e3ef5dd
Commit
1e3ef5dd
authored
Jul 02, 2020
by
aniket-engg
Browse files
Options
Browse Files
Download
Plain Diff
test working for remix-analyzer
parents
08bb4ba6
2103f874
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
34 deletions
+61
-34
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
+4
-2
workspace.json
workspace.json
+0
-3
No files found.
libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
View file @
1e3ef5dd
import
{
default
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 @
1e3ef5dd
import
{
default
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 @
1e3ef5dd
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 @
1e3ef5dd
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 @
1e3ef5dd
{
{
"extends"
:
"../../tsconfig.json"
,
"extends"
:
"../../tsconfig.json"
,
"compilerOptions"
:
{
"compilerOptions"
:
{
"types"
:
[
"node"
],
"types"
:
[
"node"
],
"esModuleInterop"
:
true
"module"
:
"commonjs"
,
"esModuleInterop"
:
true
,
"outDir"
:
"./dist"
,
},
},
"include"
:
[
"**/*.ts"
]
"include"
:
[
"**/*.ts"
]
}
}
workspace.json
View file @
1e3ef5dd
...
@@ -89,9 +89,6 @@
...
@@ -89,9 +89,6 @@
"options"
:
{
"options"
:
{
"commands"
:
[
"commands"
:
[
{
{
"command"
:
"rm -rf ../../dist"
},
{
"command"
:
"./../../node_modules/.bin/npm-run-all test"
"command"
:
"./../../node_modules/.bin/npm-run-all test"
}
}
],
],
...
...
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