/usr/share/yash/completion/test is in yash 2.35-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | # (C) 2010 magicant
# Completion script for the "test" built-in command.
# Completion function "completion/test" is used for the "[" built-in as well.
function completion/test {
	WORDS=('(' "${WORDS[2,-1]}")
	# complete unary operator
	case ${WORDS[-1]} in ('('|!|-[ao]) #>>#
		complete -D "check if a file is a block special file" -- -b
		complete -D "check if a file is a character special file" -- -c
		complete -D "check if a file is a directory" -- -d
		complete -D "check if a file exists" -- -e
		complete -D "check if a file is a regular file" -- -f
		complete -D "check if a file is owned by the current group" -- -G
		complete -D "check if a file's set-group-ID flag is set" -- -g
		complete -D "check if a file is a symbolic link" -- -h
		complete -D "check if a file's sticky bit is set" -- -k
		complete -D "check if a file is a symbolic link" -- -L
		complete -D "check if a file hasn't been accessed since last modified" -- -N
		complete -D "check if a file is owned by the current user" -- -O
		complete -D "check if a shell option is enabled" -- -o
		complete -D "check if a file is a FIFO (named pipe)" -- -p
		complete -D "check if a file is readable" -- -r
		complete -D "check if a file is a socket" -- -S
		complete -D "check if a file is not empty" -- -s
		complete -D "check if a file's set-user-ID flag is set" -- -u
		complete -D "check if a file is writable" -- -w
		complete -D "check if a file is executable" -- -x
		complete -D "check if a file descriptor is a terminal" -- -t
		complete -D "check if a string is not empty" -- -n
		complete -D "check if a string is empty" -- -z
	esac #<<#
	# complete binary operator
	case ${WORDS[-2]} in ('('|!|-[ao]) #>>#
		complete -D "check if a file is newer than another" -- -nt
		complete -D "check if a file is older than another" -- -ot
		complete -D "check if a file is a hard link to another" -- -ef
		complete -D "check if a string is the same as another" -- =
		complete -D "check if a string is the same as another" -- ==
		complete -D "check if a string is matched by a regex" -- =~
		complete -D "check if a string is different from another" -- !=
		complete -D "check if a string is the same as another according to the current locale" -- ===
		complete -D "check if a string is different from another according to the current locale" -- !==
		complete -D "compare two strings in the alphabetical order" -- '<' '<=' '>' '>='
		complete -D "check if an integer is equal to another" -- -eq
		complete -D "check if an integer is unequal to another" -- -ne
		complete -D "check if an integer is greater than another" -- -gt
		complete -D "check if an integer is greater than or equal to another" -- -ge
		complete -D "check if an integer is less than another" -- -lt
		complete -D "check if an integer is less than or equal to another" -- -le
		complete -D "check if a version number is equal to another" -- -veq
		complete -D "check if a version number is unequal to another" -- -vne
		complete -D "check if a version number is greater than another" -- -vgt
		complete -D "check if a version number is greater than or equal to another" -- -vge
		complete -D "check if a version number is less than another" -- -vlt
		complete -D "check if a version number is less than or equal to another" -- -vle
	esac #<<#
	# complete operand of the "-o" unary operator
	case ${WORDS[-2]} in ('('|!|-[ao])
		case ${WORDS[-1]} in (-o)
			if command -fv completion/set::completelongoption >/dev/null 2>&1 ||
					. -AL completion/set; then
				typeset SOPTIONS LOPTIONS PREFIX prog=set
				SOPTIONS=() LOPTIONS=()
				case $TARGETWORD in
				(\?*)
					TARGETWORD=${TARGETWORD#\?} PREFIX=\?
					;;
				(*)
					PREFIX=
					;;
				esac
				command -f completion/set::getopt set
				command -f completion/set::completelongoption
			fi
			return
		esac
	esac
	# complete operand of other operators
	complete -f
}
# vim: set ft=sh ts=8 sts=8 sw=8 noet:
 |