forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileSystem.test.ts
More file actions
25 lines (18 loc) · 948 Bytes
/
FileSystem.test.ts
File metadata and controls
25 lines (18 loc) · 948 Bytes
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
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { FileSystem } from '../FileSystem';
import { PosixModeBits } from '../PosixModeBits';
// The PosixModeBits are intended to be used with bitwise operations.
// tslint:disable:no-bitwise
test('PosixModeBits tests', () => {
let modeBits: number = PosixModeBits.AllRead | PosixModeBits.AllWrite;
expect(FileSystem.formatPosixModeBits(modeBits)).toEqual('-rw-rw-rw-');
modeBits |= PosixModeBits.GroupExecute;
expect(FileSystem.formatPosixModeBits(modeBits)).toEqual('-rw-rwxrw-');
// Add the group execute bit
modeBits |= PosixModeBits.OthersExecute;
expect(FileSystem.formatPosixModeBits(modeBits)).toEqual('-rw-rwxrwx');
// Add the group execute bit
modeBits &= ~PosixModeBits.AllWrite;
expect(FileSystem.formatPosixModeBits(modeBits)).toEqual('-r--r-xr-x');
});