Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Nov 1, 2024
1 parent 2b99718 commit 53307b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/shell_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class ShellImpl implements IShellWorker {
}

_filenameExpansion(args: string[]): string[] {
let ret: string[] = []
let ret: string[] = [];
let nFlags = 0;

// ToDo:
Expand Down Expand Up @@ -254,12 +254,12 @@ export class ShellImpl implements IShellWorker {
possibles = possibles.filter((path: string) => !path.startsWith('.'));

if (relativePath.length > 0) {
possibles = possibles.map((path: string) => relativePath + '/' + path);
possibles = possibles.map((path: string) => relativePath + '/' + path);
}
ret = ret.concat(possibles);
}

if (ret.length == nFlags) {
if (ret.length === nFlags) {
// If no matches return initial arguments.
ret = args;
}
Expand Down
11 changes: 4 additions & 7 deletions test/tests/shell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ test.describe('Shell', () => {

test('should include directory contents in match', async ({ page }) => {
const output = await shellLineComplex(page, 'ls *');
expect(output).toMatch('\r\nfile1.txt file2.txt otherfile\r\n\r\ndir:\r\nsubdir subfile.md subfile.txt\r\n');
expect(output).toMatch(
'\r\nfile1.txt file2.txt otherfile\r\n\r\ndir:\r\nsubdir subfile.md subfile.txt\r\n'
);
});

test('should expand ? in pwd', async ({ page }) => {
Expand All @@ -458,19 +460,14 @@ test.describe('Shell', () => {
});

test('should match special characters', async ({ page }) => {
const output = await shellLineComplexN(page, [
'touch ab+c',
'ls a*',
'ls *+c',
]);
const output = await shellLineComplexN(page, ['touch ab+c', 'ls a*', 'ls *+c']);
expect(output[1]).toMatch('\r\nab+c\r\n');
expect(output[2]).toMatch('\r\nab+c\r\n');
});

test('should expand * in subdirectory', async ({ page }) => {
const output0 = await shellLineComplex(page, 'ls dir/subf*');
expect(output0).toMatch(/\r\ndir\/subfile\.md\s+dir\/subfile\.txt\r\n/);

});
});
});

0 comments on commit 53307b6

Please sign in to comment.