FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/raw-reference.js at master · mmalecki/nodegit · GitHub
mmalecki
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
test
/
raw-reference.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
82 lines (68 loc) · 2.36 KB
Breadcrumbs
nodegit
/
test
/
raw-reference.js
Copy path
File metadata and controls
82 lines (68 loc) · 2.36 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var
git
=
require
(
'../'
)
.
raw
,
rimraf
=
require
(
'../vendor/rimraf'
)
;
// Helper functions
var
helper
=
{
// Test if obj is a true function
testFunction
:
function
(
test
,
obj
,
label
)
{
// The object reports itself as a function
test
(
typeof
obj
,
'function'
,
label
+
' reports as a function.'
)
;
// This ensures the repo is actually a derivative of the Function [[Class]]
test
(
toString
.
call
(
obj
)
,
'[object Function]'
,
label
+
' [[Class]] is of type function.'
)
;
}
,
// Test code and handle exception thrown
testException
:
function
(
test
,
fun
,
label
)
{
try
{
fun
(
)
;
test
(
false
,
label
)
;
}
catch
(
ex
)
{
test
(
true
,
label
)
;
}
}
}
;
// Ref
exports
.
constructor
=
function
(
test
)
{
test
.
expect
(
3
)
;
// Test for function
helper
.
testFunction
(
test
.
equals
,
git
.
Ref
,
'Ref'
)
;
// Ensure we get an instance of Ref
test
.
ok
(
new
git
.
Ref
(
)
instanceof
git
.
Ref
,
'Invocation returns an instance of Ref'
)
;
test
.
done
(
)
;
}
;
// Ref::Lookup
exports
.
lookup
=
function
(
test
)
{
var
testRepo
=
new
git
.
Repo
(
)
,
master
=
new
git
.
Ref
(
)
;
test
.
expect
(
5
)
;
// Test for function
helper
.
testFunction
(
test
.
equals
,
master
.
lookup
,
'Ref::Lookup'
)
;
// Test repo argument existence
helper
.
testException
(
test
.
ok
,
function
(
)
{
master
.
lookup
(
)
;
}
,
'Throw an exception if no repo'
)
;
// Test name argument existence
helper
.
testException
(
test
.
ok
,
function
(
)
{
master
.
lookup
(
testRepo
)
;
}
,
'Throw an exception if no name'
)
;
// Test callback argument existence
helper
.
testException
(
test
.
ok
,
function
(
)
{
master
.
lookup
(
testRepo
,
'refs/heads/master'
)
;
}
,
'Throw an exception if no callback'
)
;
// Cleanup, remove test repo directory - if it exists
rimraf
(
'./test.git'
,
function
(
)
{
// // Create bare repo and test for creation
// testRepo.init( './test.git', true, function( err, path, is_bare ) {
// test.equals( 0, err, 'Successfully created bare repository' );
// // Verify repo exists
// testRepo.open( './test.git', function(err, path) {
// test.equals( 0, err, 'Valid repository created' );
// test.equals( true, is_bare, 'Returns valid is_bare value' );
// testRepo.free();
// // Cleanup, remove test repo directory
// rimraf( './test.git', function() {
test
.
done
(
)
;
// });
// });
// });
}
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL