1
1
# This file is a part of Julia. License is MIT: http://julialang.org/license
2
2
3
- @testset " libgit2" begin
3
+ # @testset "libgit2" begin
4
4
5
5
const LIBGIT2_VER = v " 0.23.0"
6
6
7
- # ########
8
- # Setup #
9
- # ########
10
-
11
- function temp_dir (fn:: Function , remove_tmp_dir:: Bool = true )
12
- tmpdir = joinpath (tempdir (),randstring ())
13
- @test ! isdir (tmpdir)
14
- try
15
- mkdir (tmpdir)
16
- @test isdir (tmpdir)
17
- fn (tmpdir)
18
- finally
19
- remove_tmp_dir && rm (tmpdir, recursive= true )
20
- end
21
- end
22
-
23
-
24
7
# ########
25
8
# TESTS #
26
9
# ########
27
10
28
- @testset " Check library verison" begin
11
+ # @testset "Check library verison" begin
29
12
v = LibGit2. version ()
30
13
@test v. major == LIBGIT2_VER. major && v. minor >= LIBGIT2_VER. minor
31
- end
14
+ # end
32
15
33
- @testset " OID" begin
16
+ # @testset "OID" begin
34
17
z = LibGit2. Oid ()
35
18
@test LibGit2. iszero (z)
36
19
@test z == zero (LibGit2. Oid)
41
24
@test z == LibGit2. Oid (pointer (rr))
42
25
for i in 11 : length (rr); rr[i] = 0 ; end
43
26
@test LibGit2. Oid (rr) == LibGit2. Oid (rs[1 : 20 ])
44
- end
27
+ # end
45
28
46
- @testset " StrArrayStruct" begin
29
+ # @testset "StrArrayStruct" begin
47
30
p1 = " XXX"
48
31
p2 = " YYY"
49
32
sa1 = LibGit2. StrArrayStruct (p1)
67
50
finally
68
51
finalize (sa2)
69
52
end
70
- end
53
+ # end
71
54
72
- @testset " Signature" begin
55
+ # @testset "Signature" begin
73
56
sig
= LibGit2
. Signature (
" AAA" ,
" [email protected] " ,
round (
time (),
0 ),
0 )
74
57
git_sig = convert (LibGit2. GitSignature, sig)
75
58
sig2 = LibGit2. Signature (git_sig)
76
59
finalize (git_sig)
77
60
@test sig. name == sig2. name
78
61
@test sig. email == sig2. email
79
62
@test sig. time == sig2. time
80
- end
63
+ # end
81
64
82
- temp_dir () do dir
65
+ mktempdir () do dir
83
66
84
67
# test parameters
85
68
repo_url = " https://github.com/JuliaLang/Example.jl"
@@ -97,7 +80,7 @@ temp_dir() do dir
97
80
tag1 = " tag1"
98
81
tag2 = " tag2"
99
82
100
- @testset " Configuration" begin
83
+ # @testset "Configuration" begin
101
84
cfg = LibGit2. GitConfig (joinpath (dir, config_file), LibGit2. Consts. CONFIG_LEVEL_APP)
102
85
try
103
86
@test_throws LibGit2. Error. GitError LibGit2. get (AbstractString, cfg, " tmp.str" )
@@ -115,10 +98,10 @@ temp_dir() do dir
115
98
finally
116
99
finalize (cfg)
117
100
end
118
- end
101
+ # end
119
102
120
- @testset " Initializing repository" begin
121
- @testset " with remote branch" begin
103
+ # @testset "Initializing repository" begin
104
+ # @testset "with remote branch" begin
122
105
repo = LibGit2. init (cache_repo)
123
106
try
124
107
@test isdir (cache_repo)
@@ -138,9 +121,9 @@ temp_dir() do dir
138
121
finally
139
122
finalize (repo)
140
123
end
141
- end
124
+ # end
142
125
143
- @testset " bare" begin
126
+ # @testset "bare" begin
144
127
path = joinpath (dir, " Example.Bare" )
145
128
repo = LibGit2. init (path, true )
146
129
try
@@ -149,12 +132,12 @@ temp_dir() do dir
149
132
finally
150
133
finalize (repo)
151
134
end
152
- end
153
- end
135
+ # end
136
+ # end
154
137
155
- @testset " Cloning repository" begin
138
+ # @testset "Cloning repository" begin
156
139
157
- @testset " bare" begin
140
+ # @testset "bare" begin
158
141
repo_path = joinpath (dir, " Example.Bare1" )
159
142
repo = LibGit2. clone (cache_repo, repo_path, isbare = true )
160
143
try
@@ -163,8 +146,8 @@ temp_dir() do dir
163
146
finally
164
147
finalize (repo)
165
148
end
166
- end
167
- @testset " bare with remote callback" begin
149
+ # end
150
+ # @testset "bare with remote callback" begin
168
151
repo_path = joinpath (dir, " Example.Bare2" )
169
152
repo = LibGit2. clone (cache_repo, repo_path, isbare = true , remote_cb = LibGit2. mirror_cb ())
170
153
try
@@ -179,21 +162,21 @@ temp_dir() do dir
179
162
finally
180
163
finalize (repo)
181
164
end
182
- end
183
- @testset " normal" begin
165
+ # end
166
+ # @testset "normal" begin
184
167
repo = LibGit2. clone (cache_repo, test_repo, remote_cb = LibGit2. mirror_cb ())
185
168
try
186
169
@test isdir (test_repo)
187
170
@test isdir (joinpath (test_repo, " .git" ))
188
171
finally
189
172
finalize (repo)
190
173
end
191
- end
192
- end
174
+ # end
175
+ # end
193
176
194
- @testset " Update cache repository" begin
177
+ # @testset "Update cache repository" begin
195
178
196
- @testset " with commits" begin
179
+ # @testset "with commits" begin
197
180
repo = LibGit2. GitRepo (cache_repo)
198
181
repo_file = open (joinpath (cache_repo,test_file), " a" )
199
182
try
@@ -239,9 +222,9 @@ temp_dir() do dir
239
222
finalize (repo)
240
223
close (repo_file)
241
224
end
242
- end
225
+ # end
243
226
244
- @testset " with branch" begin
227
+ # @testset "with branch" begin
245
228
repo = LibGit2. GitRepo (cache_repo)
246
229
try
247
230
brnch = LibGit2. branch (repo)
@@ -255,9 +238,9 @@ temp_dir() do dir
255
238
finally
256
239
finalize (repo)
257
240
end
258
- end
241
+ # end
259
242
260
- @testset " with default configuration" begin
243
+ # @testset "with default configuration" begin
261
244
repo = LibGit2. GitRepo (cache_repo)
262
245
try
263
246
try
@@ -277,10 +260,10 @@ temp_dir() do dir
277
260
finally
278
261
finalize (repo)
279
262
end
280
- end
263
+ # end
281
264
282
265
283
- @testset " with tags" begin
266
+ # @testset "with tags" begin
284
267
repo = LibGit2. GitRepo (cache_repo)
285
268
try
286
269
tags = LibGit2. tag_list (repo)
@@ -306,10 +289,10 @@ temp_dir() do dir
306
289
finally
307
290
finalize (repo)
308
291
end
309
- end
310
- end
292
+ # end
293
+ # end
311
294
312
- @testset " Fetch from cache repository" begin
295
+ # @testset "Fetch from cache repository" begin
313
296
repo = LibGit2. GitRepo (test_repo)
314
297
try
315
298
# fetch changes
@@ -326,14 +309,14 @@ temp_dir() do dir
326
309
finally
327
310
finalize (repo)
328
311
end
329
- end
312
+ # end
330
313
331
- @testset " Examine test repository" begin
332
- @testset " files" begin
314
+ # @testset "Examine test repository" begin
315
+ # @testset "files" begin
333
316
@test readstring (joinpath (test_repo, test_file)) == readstring (joinpath (cache_repo, test_file))
334
- end
317
+ # end
335
318
336
- @testset " tags & branches" begin
319
+ # @testset "tags & branches" begin
337
320
repo = LibGit2. GitRepo (test_repo)
338
321
try
339
322
# all tag in place
@@ -348,9 +331,9 @@ temp_dir() do dir
348
331
finally
349
332
finalize (repo)
350
333
end
351
- end
334
+ # end
352
335
353
- @testset " commits with revwalk" begin
336
+ # @testset "commits with revwalk" begin
354
337
repo = LibGit2. GitRepo (test_repo)
355
338
cache = LibGit2. GitRepo (cache_repo)
356
339
try
@@ -365,17 +348,17 @@ temp_dir() do dir
365
348
cache_oids = LibGit2. with (LibGit2. GitRevWalker (cache)) do walker
366
349
LibGit2. map ((oid,repo)-> string (oid), walker, by = LibGit2. Consts. SORT_TIME)
367
350
end
368
- @testset for i in eachindex (oids)
351
+ for i in eachindex (oids)
369
352
@test cache_oids[i] == test_oids[i]
370
353
end
371
354
finally
372
355
finalize (repo)
373
356
finalize (cache)
374
357
end
375
- end
376
- end
358
+ # end
359
+ # end
377
360
378
- @testset " Transact test repository" begin
361
+ # @testset "Transact test repository" begin
379
362
repo = LibGit2. GitRepo (test_repo)
380
363
try
381
364
cp (joinpath (test_repo, test_file), joinpath (test_repo, " CCC" ))
@@ -394,8 +377,8 @@ temp_dir() do dir
394
377
finally
395
378
finalize (repo)
396
379
end
397
- end
380
+ # end
398
381
399
382
end
400
383
401
- end
384
+ # end
0 commit comments