Skip to content

Commit 3c6daf8

Browse files
committed
Add more test comments
1 parent c2551e3 commit 3c6daf8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

os/test/src/ZipOpTests.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ object ZipOpTests extends TestSuite {
327327
if (!scala.util.Properties.isWin) {
328328
val (source, unzipped, link) = prepare(wd, followLinks = false)
329329

330+
// test all files are there
330331
assert(walkRel(source).toSet == walkRel(unzipped).toSet)
332+
// test all permissions are preserved
331333
assert(os.walk.stream(source)
332334
.filter(!os.isLink(_))
333335
.forall(p => os.perms(p) == os.perms(unzipped / p.relativeTo(source))))
@@ -343,11 +345,14 @@ object ZipOpTests extends TestSuite {
343345
if (!scala.util.Properties.isWin) {
344346
val (source, unzipped, link) = prepare(wd, zipStream = true, followLinks = true)
345347

348+
// test all files are there
346349
assert(walkRel(source).toSet == walkRel(unzipped).toSet)
350+
// test all permissions are preserved
347351
assert(os.walk.stream(source)
348352
.filter(!os.isLink(_))
349353
.forall(p => os.perms(p) == os.perms(unzipped / p.relativeTo(source))))
350354

355+
// test symlinks are zipped as the referenced files
351356
val unzippedLink = unzipped / link
352357
assert(os.isFile(unzippedLink))
353358
assert(os.read(os.readLink.absolute(source / link)) == os.read(unzippedLink))
@@ -358,11 +363,14 @@ object ZipOpTests extends TestSuite {
358363
if (!scala.util.Properties.isWin) {
359364
val (source, unzipped, link) = prepare(wd, zipStream = true, followLinks = false)
360365

366+
// test all files are there
361367
assert(walkRel(source).toSet == walkRel(unzipped).toSet)
368+
// test all permissions are preserved
362369
assert(os.walk.stream(source)
363370
.filter(!os.isLink(_))
364371
.forall(p => os.perms(p) == os.perms(unzipped / p.relativeTo(source))))
365372

373+
// test symlinks are zipped as symlinks
366374
val unzippedLink = unzipped / link
367375
assert(os.isLink(unzippedLink))
368376
assert(os.readLink(source / link) == os.readLink(unzippedLink))
@@ -373,6 +381,7 @@ object ZipOpTests extends TestSuite {
373381
if (!scala.util.Properties.isWin) {
374382
val (source, unzipped, link) = prepare(wd, unzipStream = true, followLinks = false)
375383

384+
// test all files are there
376385
assert(walkRel(source).toSet == walkRel(unzipped).toSet)
377386

378387
val unzippedLink = unzipped / link
@@ -385,8 +394,10 @@ object ZipOpTests extends TestSuite {
385394
if (!scala.util.Properties.isWin) {
386395
val (source, unzipped, link) = prepare(wd, unzipStream = true, followLinks = true)
387396

397+
// test all files are there
388398
assert(walkRel(source).toSet == walkRel(unzipped).toSet)
389399

400+
// test symlinks zipped as the referenced files are unzipped correctly
390401
val unzippedLink = unzipped / link
391402
assert(os.isFile(unzippedLink))
392403
assert(os.read(os.readLink.absolute(source / link)) == os.read(unzippedLink))
@@ -418,18 +429,22 @@ object ZipOpTests extends TestSuite {
418429
dest = wd / "newUnzipped"
419430
)
420431

432+
// test all files are there
421433
assert((walkRel(source) ++ walkRel(newSource)).toSet == walkRel(newUnzipped).toSet)
422434

435+
// test permissions of existing zip entries are preserved
423436
if (Runtime.version.feature >= 14) {
424437
assert(os.walk.stream(source)
425438
.filter(!os.isLink(_))
426439
.forall(p => os.perms(p) == os.perms(newUnzipped / p.relativeTo(source))))
427440
}
428441

442+
// test existing symlinks zipped as the referenced files are unzipped
429443
val unzippedNewLink = newUnzipped / newLink
430444
assert(os.isFile(unzippedNewLink))
431445
assert(os.read(os.readLink.absolute(newSource / newLink)) == os.read(unzippedNewLink))
432446

447+
// test permissions of newly added files are preserved
433448
val unzippedNewFile = newUnzipped / newFile
434449
if (Runtime.version.feature >= 14) {
435450
assert(os.perms(unzippedNewFile) == perms)

0 commit comments

Comments
 (0)