mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
Shell: add type
builtin
This commit is contained in:
parent
1d7a0ab5ea
commit
cb22a6642d
3 changed files with 96 additions and 0 deletions
24
Userland/Shell/Tests/builtin-test.sh
Normal file
24
Userland/Shell/Tests/builtin-test.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
source $(dirname "$0")/test-commons.inc
|
||||
|
||||
|
||||
if not [ "$(type ls)" = "ls is $(which ls)" ] { fail "'type' on a binary not working" }
|
||||
|
||||
if not [ "$(type pwd)" = "pwd is a shell builtin" ] { fail "'type' on a builtin not working" }
|
||||
|
||||
f() { ls }
|
||||
|
||||
if not [ "$(type f)" = "f is a function f() { ls }" ] { fail "'type' on a function not working" }
|
||||
|
||||
|
||||
if not [ "$(type f -f)" = "f is a function" ] { fail "'type' on a function not working with -f" }
|
||||
|
||||
alias l=ls
|
||||
|
||||
if not [ "$(type l)" = "l is aliased to `ls`" ] { fail "'type' on a alias not working" }
|
||||
|
||||
|
||||
if not [ "$(type l ls)" = "l is aliased to `ls` ls is $(which ls)" ] { fail "'type' on multiple commands not working" }
|
||||
|
||||
echo PASS
|
Loading…
Add table
Add a link
Reference in a new issue