The behaviour of echo is inconsistent between implementations, in particular regarding whether it expands escapes like `\n`. Use printf consistently in test scripts to avoid test failures from inconsistent echo behaviour. Fixes #866.
30 lines
785 B
Perl
30 lines
785 B
Perl
Setup:
|
|
|
|
$ . $TESTDIR/setup.sh
|
|
$ printf "12345678901234567890123456789012345678901234567890\n" >> ./blah.txt
|
|
|
|
Truncate to width inside input line length:
|
|
|
|
$ ag -W 20 1 < ./blah.txt
|
|
blah.txt:1:12345678901234567890 [...]
|
|
|
|
Truncate to width inside input line length, long-form:
|
|
|
|
$ ag --width 20 1 < ./blah.txt
|
|
blah.txt:1:12345678901234567890 [...]
|
|
|
|
Truncate to width outside input line length:
|
|
|
|
$ ag -W 60 1 < ./blah.txt
|
|
blah.txt:1:12345678901234567890123456789012345678901234567890
|
|
|
|
Truncate to width one less than input line length:
|
|
|
|
$ ag -W 49 1 < ./blah.txt
|
|
blah.txt:1:1234567890123456789012345678901234567890123456789 [...]
|
|
|
|
Truncate to width exactly input line length:
|
|
|
|
$ ag -W 50 1 < ./blah.txt
|
|
blah.txt:1:12345678901234567890123456789012345678901234567890
|
|
|