summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Johnsson <simon.johnsson@canonical.com>2026-02-18 15:37:48 +0100
committerJulian Andres Klode <jak@debian.org>2026-04-07 09:39:14 +0000
commite2e4e3ced75bb5e9db28cc35b6ebf371e8e5be94 (patch)
treef91e7d5cf260097e777627383adb13e0a5731c1f /test
parentb927ef91b5f6d682d7fb5e8fd8a2d5e4d7292329 (diff)
Scale history-list to screen width
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-history73
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