summaryrefslogtreecommitdiff
path: root/regress/bin/ksh
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2017-10-23 17:16:11 +0000
committeranton <anton@cvs.openbsd.org>2017-10-23 17:16:11 +0000
commit0fba49a5cd36f9a9be8ab2fdd87f0c5c4171265c (patch)
tree548dfe42179d4172b478c066ae7457af18c0a988 /regress/bin/ksh
parent6781a91f98a50ef6091d8b66d9e898c316dc46bc (diff)
Add tests for history load from file.
Diffstat (limited to 'regress/bin/ksh')
-rw-r--r--regress/bin/ksh/history.t40
1 files changed, 39 insertions, 1 deletions
diff --git a/regress/bin/ksh/history.t b/regress/bin/ksh/history.t
index 13c645e9b3c..98a85e72246 100644
--- a/regress/bin/ksh/history.t
+++ b/regress/bin/ksh/history.t
@@ -1,4 +1,4 @@
-# $OpenBSD: history.t,v 1.3 2017/08/31 06:55:01 anton Exp $
+# $OpenBSD: history.t,v 1.4 2017/10/23 17:16:10 anton Exp $
# Not tested yet:
# - commands in history file are not numbered negatively
@@ -617,3 +617,41 @@ expected-stdout:
expected-stderr-pattern:
/^X*$/m
---
+
+name: history-corrupt-1
+description:
+ Every valid history line prior to a corrupted line is loaded.
+arguments: !-i!
+env-setup: !ENV=./Env!HISTFILE=hist.file!
+file-setup: !file 644 "hist.file"
+ ls
+ cd
+file-setup: file 644 "Env"
+ PS1=X
+stdin:
+ fc -l
+expected-stdout:
+ 1 ls
+expected-stderr-pattern:
+ /^[^:]+: history file is corrupt\nX*$/m
+---
+
+name: history-long-lines-1
+description:
+ Long lines are ignored.
+arguments: !-i!
+env-setup: !ENV=./Env!HISTFILE=hist.file!
+file-setup: file 644 "hist.file"
+file-setup: file 644 "Env"
+ PS1=X
+perl-setup:
+ system('(echo ls; jot -b c -s "" 4096; jot -b d -s "" 4096; echo w) ' .
+ '>>hist.file');
+stdin:
+ fc -l
+expected-stdout:
+ 1 ls
+ 2 w
+expected-stderr-pattern:
+ /^[^:]+: ignored history line\(s\) longer than \d+ bytes\nX*$/m
+---