-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a5db09
commit ac97883
Showing
21 changed files
with
1,153 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-env mocha */ | ||
|
||
import { expect } from 'aegir/chai' | ||
import { formatMode } from '../../../src/lib/files/format-mode.js' | ||
|
||
describe('format-mode', function () { | ||
it('formats mode for directories', function () { | ||
expect(formatMode(parseInt('0777', 8), true)).to.equal('drwxrwxrwx') | ||
}) | ||
|
||
it('formats mode for files', function () { | ||
expect(formatMode(parseInt('0777', 8), false)).to.equal('-rwxrwxrwx') | ||
}) | ||
|
||
it('setgid, setuid and stick bit', function () { | ||
expect(formatMode(parseInt('1777', 8), false)).to.equal('-rwxrwxrwt') | ||
expect(formatMode(parseInt('2777', 8), false)).to.equal('-rwxrwsrwx') | ||
expect(formatMode(parseInt('4777', 8), false)).to.equal('-rwsrwxrwx') | ||
expect(formatMode(parseInt('5777', 8), false)).to.equal('-rwsrwxrwt') | ||
expect(formatMode(parseInt('6777', 8), false)).to.equal('-rwsrwsrwx') | ||
expect(formatMode(parseInt('7777', 8), false)).to.equal('-rwsrwsrwt') | ||
}) | ||
|
||
it('formats user', function () { | ||
expect(formatMode(parseInt('0100', 8), false)).to.equal('---x------') | ||
expect(formatMode(parseInt('0200', 8), false)).to.equal('--w-------') | ||
expect(formatMode(parseInt('0300', 8), false)).to.equal('--wx------') | ||
expect(formatMode(parseInt('0400', 8), false)).to.equal('-r--------') | ||
expect(formatMode(parseInt('0500', 8), false)).to.equal('-r-x------') | ||
expect(formatMode(parseInt('0600', 8), false)).to.equal('-rw-------') | ||
expect(formatMode(parseInt('0700', 8), false)).to.equal('-rwx------') | ||
}) | ||
|
||
it('formats group', function () { | ||
expect(formatMode(parseInt('0010', 8), false)).to.equal('------x---') | ||
expect(formatMode(parseInt('0020', 8), false)).to.equal('-----w----') | ||
expect(formatMode(parseInt('0030', 8), false)).to.equal('-----wx---') | ||
expect(formatMode(parseInt('0040', 8), false)).to.equal('----r-----') | ||
expect(formatMode(parseInt('0050', 8), false)).to.equal('----r-x---') | ||
expect(formatMode(parseInt('0060', 8), false)).to.equal('----rw----') | ||
expect(formatMode(parseInt('0070', 8), false)).to.equal('----rwx---') | ||
}) | ||
|
||
it('formats other', function () { | ||
expect(formatMode(parseInt('0001', 8), false)).to.equal('---------x') | ||
expect(formatMode(parseInt('0002', 8), false)).to.equal('--------w-') | ||
expect(formatMode(parseInt('0003', 8), false)).to.equal('--------wx') | ||
expect(formatMode(parseInt('0004', 8), false)).to.equal('-------r--') | ||
expect(formatMode(parseInt('0005', 8), false)).to.equal('-------r-x') | ||
expect(formatMode(parseInt('0006', 8), false)).to.equal('-------rw-') | ||
expect(formatMode(parseInt('0007', 8), false)).to.equal('-------rwx') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-env mocha */ | ||
|
||
import { expect } from 'aegir/chai' | ||
import { formatMtime } from '../../../src/lib/files/format-mtime.js' | ||
|
||
describe('format-mtime', function () { | ||
it('formats mtime', function () { | ||
expect(formatMtime({ secs: 15768000n, nsecs: 0 })).to.include('1970') | ||
}) | ||
|
||
it('formats empty mtime', function () { | ||
expect(formatMtime()).to.equal('-') | ||
}) | ||
}) |
Oops, something went wrong.