6
6
# This strange form of import is required because our ST package name has a space in it.
7
7
base = importlib .import_module ("Git blame.src.base" )
8
8
9
- # NOTE: The sample git-blame CLI outputs were taken from the https://github.com/sublimelsp/LSP
10
- # repo because they exhibit different numbers of components in author names.
11
-
12
9
13
10
class TestParsing (unittest .TestCase ):
14
11
def test_git_blame_cli_output_parsing (self ):
15
12
samples = [
13
+ # NOTE: This section of sample git-blame CLI outputs were taken from the
14
+ # https://github.com/sublimelsp/LSP repo because they exhibit different
15
+ # numbers of components in author names:
16
16
(
17
17
r"""4a3eb02f plugin/diagnostics.py (Tom van Ommeren 2019-11-27 21:42:13 +0100 1) import html""" ,
18
18
{
@@ -21,6 +21,7 @@ def test_git_blame_cli_output_parsing(self):
21
21
"file" : "plugin/diagnostics.py" ,
22
22
"line_number" : "1" ,
23
23
"sha" : "4a3eb02f" ,
24
+ "sha_normalised" : "4a3eb02f" ,
24
25
"time" : "21:42:13" ,
25
26
"timezone" : "+0100" ,
26
27
},
@@ -33,6 +34,7 @@ def test_git_blame_cli_output_parsing(self):
33
34
"file" : "plugin/diagnostics.py" ,
34
35
"line_number" : "114" ,
35
36
"sha" : "c937eff9" ,
37
+ "sha_normalised" : "c937eff9" ,
36
38
"time" : "14:29:47" ,
37
39
"timezone" : "+0100" ,
38
40
},
@@ -45,10 +47,27 @@ def test_git_blame_cli_output_parsing(self):
45
47
"file" : "plugin/diagnostics.py" ,
46
48
"line_number" : "272" ,
47
49
"sha" : "16a30de1" ,
50
+ "sha_normalised" : "16a30de1" ,
48
51
"time" : "08:34:46" ,
49
52
"timezone" : "+0200" ,
50
53
},
51
54
),
55
+ #
56
+ # A "boundary commit" SHA:
57
+ #
58
+ (
59
+ r"""^ad61094 main.go (Duncan Holm 2016-01-18 21:22:16 +0000 1) package main""" ,
60
+ {
61
+ "author" : "Duncan Holm" ,
62
+ "date" : "2016-01-18" ,
63
+ "file" : "main.go" ,
64
+ "line_number" : "1" ,
65
+ "sha" : "^ad61094" ,
66
+ "sha_normalised" : "ad61094" ,
67
+ "time" : "21:22:16" ,
68
+ "timezone" : "+0000" ,
69
+ },
70
+ ),
52
71
]
53
72
for cli_output_line , expected_result in samples :
54
73
self .assertEqual (
0 commit comments