Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db317bf

Browse files
wyardleynfischer
authored andcommitted
Add test case for sed on empty file (#904)
As discussed as an aside in #900, add test case with an empty file.
1 parent 0d5ecb6 commit db317bf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/resources/sed/empty.txt

Whitespace-only changes.

test/sed.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,9 @@ test('glob file names, with in-place-replacement', t => {
174174
t.is(shell.cat(`${t.context.tmp}/file1.txt`).toString(), 'hello1\n');
175175
t.is(shell.cat(`${t.context.tmp}/file2.txt`).toString(), 'hello2\n');
176176
});
177+
178+
test('empty file', t => {
179+
const result = shell.sed('widget', 'wizzle', 'test/resources/sed/empty.txt');
180+
t.is(result.code, 0);
181+
t.is(result.toString(), '');
182+
});

0 commit comments

Comments
 (0)