diff --git a/test.sh b/test.sh index 4a86e4f..9f6beaa 100755 --- a/test.sh +++ b/test.sh @@ -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); diff --git a/test/dcat_test.dart b/test/dcat_test.dart index c4cca9e..8512387 100644 --- a/test/dcat_test.dart +++ b/test/dcat_test.dart @@ -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());