Added more tests.

This commit is contained in:
Erik C. Thauvin 2022-01-26 15:17:29 -08:00
parent 64d60bbf4e
commit cdf9a43b5f
2 changed files with 12 additions and 0 deletions

View file

@ -7,6 +7,7 @@ GREEN='\033[0;32m'
for o in -A -b -e -E -n -s -t -T -v
do
echo -e "Testing: cat $o"
cat $o test/* > $TMPCAT
bin/dcat $o test/* > $TMPDCAT
if ! $(diff -q $TMPCAT $TMPDCAT);

View file

@ -254,6 +254,17 @@ void main() {
expect(lines.last, equals(sampleText));
});
test('cat file - source', () async {
final tmp = makeTmpFile();
final result = await cat([sampleFile, '-'], tmp.openWrite(),
input: File(sourceFile).openRead());
expect(result.isSuccess, true, reason: 'result is success');
final lines = await tmp.readAsLines();
expect(lines.first, startsWith('Lorem'), reason: 'Lorem in first line');
expect(lines.last.endsWith(''), false,
reason: "doesn't end with checkmark");
});
test('cat source', () async {
final tmp = makeTmpFile();
await cat([sourceFile], tmp.openWrite());