Rewrite builtin functions in rust

This commit is contained in:
Fabian Boehm
2023-08-08 20:12:05 +02:00
parent 5e78cf8c41
commit 6489ef5ac0
7 changed files with 473 additions and 1 deletions

View File

@@ -9,6 +9,10 @@ end
functions --details f1 f2
#CHECKERR: functions: --details: expected 1 arguments; got 2
# Verify that it still mentions "--details" even if it isn't the last option.
functions --details --verbose f1 f2
#CHECKERR: functions: --details: expected 1 arguments; got 2
# ==========
# Verify that `functions --details` works as expected when given the name of a
# known function.
@@ -185,3 +189,38 @@ functions --handlers-type signal
# CHECK: SIGTERM term1
# CHECK: SIGTERM term2
# CHECK: SIGTERM term3
# See how --names and --all work.
# We don't want to list all of our functions here,
# so we just match a few that we know are there.
functions -n | string match cd
# CHECK: cd
functions --names | string match __fish_config_interactive
echo $status
# CHECK: 1
functions --names -a | string match __fish_config_interactive
# CHECK: __fish_config_interactive
functions --description ""
# CHECKERR: functions: Expected exactly one function name
# CHECKERR: checks/functions.fish (line {{\d+}}):
# CHECKERR: functions --description ""
# CHECKERR: ^
# CHECKERR: (Type 'help functions' for related documentation)
function foo --on-variable foo; end
# This should print *everything*
functions --handlers-type "" | string match 'Event *'
# CHECK: Event signal
# CHECK: Event variable
# CHECK: Event generic
functions -e foo
functions --details --verbose thisfunctiondoesnotexist
# CHECK: n/a
# CHECK: n/a
# CHECK: 0
# CHECK: n/a
# CHECK: n/a

View File

@@ -64,3 +64,8 @@ expect_str("# Defined interactively\r\n")
expect_str("function foo")
expect_str("end")
expect_prompt()
# See that `functions` terminates
sendline("functions")
expect_re(".*fish_prompt,.*")
expect_prompt()