FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/utils/leak_test.js at master · smbera/nodegit · GitHub
smbera
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
test
/
utils
/
leak_test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (27 loc) · 1.14 KB
Breadcrumbs
nodegit
/
test
/
utils
/
leak_test.js
Copy path
File metadata and controls
33 lines (27 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var
assert
=
require
(
"assert"
)
;
var
garbageCollect
=
require
(
"./garbage_collect"
)
;
function
leakTest
(
Type
,
getInstance
)
{
garbageCollect
(
)
;
var
startSelfFreeingCount
=
Type
.
getSelfFreeingInstanceCount
(
)
;
var
startNonSelfFreeingCount
=
Type
.
getNonSelfFreeingConstructedCount
(
)
;
var
resolve
;
var
promise
=
new
Promise
(
function
(
_resolve
)
{
resolve
=
_resolve
;
}
)
;
getInstance
(
)
.
then
(
function
(
)
{
var
selfFreeingCount
=
Type
.
getSelfFreeingInstanceCount
(
)
;
assert
.
equal
(
startSelfFreeingCount
+
1
,
selfFreeingCount
)
;
// get out of this promise chain to help GC get rid of the commit
setTimeout
(
resolve
,
0
)
;
}
)
;
return
promise
.
then
(
function
(
)
{
garbageCollect
(
)
;
var
endSelfFreeingCount
=
Type
.
getSelfFreeingInstanceCount
(
)
;
var
endNonSelfFreeingCount
=
Type
.
getNonSelfFreeingConstructedCount
(
)
;
// any new self-freeing commits should have been freed
assert
.
equal
(
startSelfFreeingCount
,
endSelfFreeingCount
)
;
// no new non-self-freeing commits should have been constructed
assert
.
equal
(
startNonSelfFreeingCount
,
endNonSelfFreeingCount
)
;
}
)
;
}
module
.
exports
=
leakTest
;
Back
|
FazBrowse Home
|
New Git URL