diff options
| author | Julian Andres Klode <jak@debian.org> | 2026-04-07 09:39:55 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-04-07 09:39:55 +0000 |
| commit | 9a97c0e647609da41a1df6574d98320e5e253988 (patch) | |
| tree | 2eba28e277f4ad7ab56f8d015decd09d0712fb2f /test | |
| parent | b927ef91b5f6d682d7fb5e8fd8a2d5e4d7292329 (diff) | |
| parent | 58821c2dfc9fefb09d6ff6655e435bacdfabe173 (diff) | |
Merge branch 'history-command-list-width-scaling' into 'main'
Scale `apt history-list` to the screen width
See merge request apt-team/apt!555
Diffstat (limited to 'test')
| -rwxr-xr-x | test/integration/test-history | 73 |
1 files changed, 58 insertions, 15 deletions
diff --git a/test/integration/test-history b/test/integration/test-history index 34108e357..48966d011 100755 --- a/test/integration/test-history +++ b/test/integration/test-history @@ -54,20 +54,7 @@ Command line: apt-get install pkg1 Packages changed: Install pkg1:amd64 (1) " normalizedinfo - -# replace aribtrary command line and date with "dummy". -normalizedlist() { - apt history-list | sed -E 's/^([0-9]+)[[:space:]]+'\ -'.*'\ -'[0-9]{4}-[0-9]{2}-[0-9]{2}[[:space:]]+'\ -'[0-9]{2}:[0-9]{2}:[0-9]{2}/'\ -'\1 dummy dummy /' -} - -testsuccessequal "ID Command line Date and Time Action Changes -0 dummy dummy Install 1 -1 dummy dummy Install 1 " normalizedlist ################################################################################ # Read previous history for manipulation @@ -118,9 +105,9 @@ Commandline: install nothing End-Date: dummy EOF -testsuccessequal "ID Command line Date and Time Action Changes +testsuccessequal "ID Command line Date and Time Action Changes -0 install nothing dummy 0 " normalizedlist +0 install nothing dummy 0 " apt history-list testsuccessequal "Transaction ID: 0 Start time: dummy @@ -129,6 +116,62 @@ Requested by: Command line: install nothing Packages changed:" normalizedinfo +cat > rootdir/var/log/apt/history.log << EOF +Start-Date: 1970-01-01 00:00:00 +Commandline: install nothing +Install: nothing +End-Date: 1970-01-01 00:00:00 + +Start-Date: 1971-01-01 00:00:00 +Commandline: remove something +Remove: something +End-Date: 1971-01-01 00:00:00 +EOF + +testsuccessequal "ID Command line Date and Time Action Changes + +0 install nothing 1970-01-01 00:00:00 Install 1 +1 remove something 1971-01-01 00:00:00 Remove 1 " apt history-list + +################################################################################ +# Test different column widths +################################################################################ +settestcolumnwidth() { + local columns=$1 + local A_chars + A_chars=$(printf 'a%.0s' $(seq 1 "$columns")) + + cat > rootdir/var/log/apt/history.log << EOF +Start-Date: dummy +Commandline: $A_chars +Install: nothing +End-Date: dummy +EOF + + export COLUMNS="$columns" +} + +settestcolumnwidth 80 +testsuccessequal "ID Command line Date and Time Action Changes + +0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...dummy Install 1 " apt history-list + +settestcolumnwidth 50 +testsuccessequal "ID Command line Date and Time Action Changes + +0 aaaaaaaaaaaaa...dummy Install 1 " apt history-list + +settestcolumnwidth 100 +testsuccessequal "ID Command line Date and Time Action Changes + +0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...dummy Install 1 " apt history-list + +settestcolumnwidth 60 +testsuccessequal "ID Command line Date and Time Action Changes + +0 aaaaaaaaaaaaaaaaaaaaaaa...dummy Install 1 " apt history-list + + testfailureequal "E: Incorrect usage, no ID was given." apt history-redo testfailureequal "E: Incorrect usage, no ID was given." apt history-undo testfailureequal "E: Incorrect usage, no ID was given." apt history-rollback |
