FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/tests/diff.js at v0.2.5 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
21
(21)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
test
/
tests
/
diff.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (44 loc) · 1.8 KB
Breadcrumbs
nodegit
/
test
/
tests
/
diff.js
Copy path
File metadata and controls
56 lines (44 loc) · 1.8 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
var
assert
=
require
(
"assert"
)
;
var
path
=
require
(
"path"
)
;
describe
(
"Diff"
,
function
(
)
{
var
reposPath
=
path
.
resolve
(
"test/repos/workdir/.git"
)
;
var
oid
=
"fce88902e66c72b5b93e75bdb5ae717038b221f6"
;
var
Repository
=
require
(
"../../lib/repository"
)
;
var
Diff
=
require
(
"../../lib/diff"
)
;
before
(
function
(
)
{
var
test
=
this
;
return
Repository
.
open
(
reposPath
)
.
then
(
function
(
repository
)
{
test
.
repository
=
repository
;
return
repository
.
getCommit
(
oid
)
.
then
(
function
(
commit
)
{
test
.
commit
=
commit
;
return
commit
.
getDiff
(
)
.
then
(
function
(
diff
)
{
test
.
diff
=
diff
;
}
)
;
}
)
;
}
)
;
}
)
;
it
(
"can walk a DiffList"
,
function
(
)
{
var
patch
=
this
.
diff
[
0
]
.
patches
(
)
[
0
]
;
assert
.
equal
(
patch
.
oldFile
(
)
.
path
(
)
,
"README.md"
)
;
assert
.
equal
(
patch
.
newFile
(
)
.
path
(
)
,
"README.md"
)
;
assert
.
equal
(
patch
.
size
(
)
,
1
)
;
assert
.
ok
(
patch
.
isModified
(
)
)
;
var
hunk
=
patch
.
hunks
(
)
[
0
]
;
assert
.
equal
(
hunk
.
size
(
)
,
5
)
;
var
lines
=
hunk
.
lines
(
)
;
assert
.
equal
(
lines
[
0
]
.
origin
(
)
,
Diff
.
LINE
.
CONTEXT
)
;
assert
.
equal
(
lines
[
1
]
.
origin
(
)
,
Diff
.
LINE
.
CONTEXT
)
;
assert
.
equal
(
lines
[
2
]
.
origin
(
)
,
Diff
.
LINE
.
CONTEXT
)
;
var
oldContent
=
"\n__Before submitting a pull request, please ensure "
+
"both unit tests and lint checks pass.__\n"
;
assert
.
equal
(
lines
[
2
]
.
content
(
)
,
oldContent
)
;
assert
.
equal
(
lines
[
3
]
.
origin
(
)
,
Diff
.
LINE
.
DELETION
)
;
assert
.
equal
(
lines
[
4
]
.
contentLen
(
)
,
90
)
;
var
newContent
=
"__Before submitting a pull request, please ensure "
+
"both that you've added unit tests to cover your shiny new code, "
+
"and that all unit tests and lint checks pass.__\n"
;
assert
.
equal
(
lines
[
3
]
.
content
(
)
,
newContent
)
;
assert
.
equal
(
lines
[
4
]
.
origin
(
)
,
Diff
.
LINE
.
ADDITION
)
;
assert
.
equal
(
lines
[
3
]
.
contentLen
(
)
,
162
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL