SHA256
1
0
forked from pool/tcsh

Add a test case for history merge

OBS-URL: https://build.opensuse.org/package/show/shells/tcsh?expand=0&rev=158
This commit is contained in:
Dr. Werner Fink 2023-07-24 08:12:57 +00:00 committed by Git OBS Bridge
parent 760b8e23d6
commit dcef063dbb
2 changed files with 62 additions and 1 deletions

View File

@ -26,7 +26,62 @@
* Hnum and Href (because fastMergeErase is true). So now reset all the * Hnum and Href (because fastMergeErase is true). So now reset all the
* values based on the final ordering of the history list. */ * values based on the final ordering of the history list. */
- if (mflg) { - if (mflg) {
+ if (mflg && fastMergeErase) { + if (mflg /* && fastMergeErase */) {
int n = eventno; int n = eventno;
struct Hist *hp = &Histlist; struct Hist *hp = &Histlist;
while ((hp = hp->Hnext)) while ((hp = hp->Hnext))
--- tests/history.at
+++ tests/history.at 2023-07-24 07:53:41.471413277 +0000
@@ -218,6 +218,52 @@ dnl savehist) set to 0 instead of 1.
AT_CLEANUP()
+AT_SETUP([History merge])
+dnl Check if history merge really works out
+
+AT_DATA([hist-merge.csh],
+[[set histfile=test.history histdup=prev history=(6 "%h TIME %R\n")
+set savehist=(6 merge)
+printf "'%s' %s\n" "$histdup" "$history"
+history -c
+: 1
+: 2
+: 3
+: 4
+: 5
+history -S
+: a
+: b
+: c
+: d
+: e
+history -S
+history -L
+history 6
+]])
+
+AT_CHECK([tcsh -f -q -i < hist-merge.csh], ,
+[> 'prev' 6 %h TIME %R\n
+ 24 TIME : b
+ 25 TIME : c
+ 26 TIME : d
+ 27 TIME : e
+ 28 TIME history -S
+ 29 TIME history 6
+> exit
+],)
+
+dnl In broken case we see the former history instead
+dnl > 'prev' 6 %h TIME %R\n
+dnl 24 TIME : 4
+dnl 25 TIME : 3
+dnl 26 TIME : 2
+dnl 27 TIME : 1
+dnl 28 TIME history -S
+dnl 29 TIME history 6
+dnl > exit
+
+AT_CLEANUP()
dnl
dnl History faults

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jul 24 08:12:01 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Extend tcsh-6.24.10-history-merge.dif
* Add a test case
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jul 21 09:19:02 UTC 2023 - Dr. Werner Fink <werner@suse.de> Fri Jul 21 09:19:02 UTC 2023 - Dr. Werner Fink <werner@suse.de>