# Run from the nushell config directory: nu --no-config-file tests/carapace-completion.nu alias g = git source ../autoload/30-carapace.nu let alias_input = 'g che' | commandline complete --input if $alias_input.place.command != [git che] { error make {msg: 'alias was not expanded for external completion'} } if not ('g che' | commandline complete | any { $in | str starts-with 'checkout' }) { error make {msg: 'Carapace did not complete git via alias'} } if not ('git config.nu' | commandline complete | any { $in == 'config.nu' }) { error make {msg: 'unmatched positional argument did not fall back to files'} } if not ('java config.n' | commandline complete | any { $in == 'config.nu' }) { error make {msg: 'java positional argument did not fall back to files'} } if ('git --zzzznotaflag' | commandline complete | is-not-empty) { error make {msg: 'unmatched flag unexpectedly fell back to files'} } if not ('carapace --ver' | commandline complete | any { ($in | str trim) == '--version' }) { error make {msg: 'Carapace did not complete its own flags'} }