fix and test cd builtin.
This commit is contained in:
parent
58d1627b08
commit
f81b526bd0
3
check.sh
3
check.sh
|
@ -95,6 +95,9 @@ tests="
|
|||
70-slash-string
|
||||
70-slash-string-slash
|
||||
|
||||
100-cd
|
||||
100-cd-foo
|
||||
|
||||
100-sed
|
||||
100-sed-once
|
||||
100-sed-global
|
||||
|
|
|
@ -65,8 +65,14 @@
|
|||
((dir)
|
||||
(let ((old (variable "OLDPWD")))
|
||||
(assignment "OLDPWD" (getcwd))
|
||||
(if (string=? dir "-") (chdir old)
|
||||
(chdir dir))))
|
||||
(catch #t
|
||||
(lambda _
|
||||
(if (string=? dir "-") (chdir old)
|
||||
(chdir dir))
|
||||
0)
|
||||
(lambda (key command fmt args exit)
|
||||
(apply format (current-error-port) "cd: ~a: ~a\n" (cons dir args))
|
||||
1))))
|
||||
((args ...)
|
||||
(format (current-error-port) "cd: too many arguments: ~a\n" (string-join args)))))
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1 @@
|
|||
cd /foo
|
|
@ -0,0 +1,2 @@
|
|||
cd /bin
|
||||
pwd
|
|
@ -0,0 +1 @@
|
|||
/bin
|
Loading…
Reference in New Issue