mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	tests/builtins.sh: correctly count errors (re: 1bc2c74c)
				
					
				
			This commit is contained in:
		
							parent
							
								
									ddaa145b3d
								
							
						
					
					
						commit
						2ae6e2cf55
					
				
					 1 changed files with 14 additions and 8 deletions
				
			
		| 
						 | 
					@ -938,14 +938,20 @@ EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ==========
 | 
					# ==========
 | 
				
			||||||
# Builtins should handle unrecognized options correctly
 | 
					# Builtins should handle unrecognized options correctly
 | 
				
			||||||
(
 | 
					while IFS= read -r bltin <&3
 | 
				
			||||||
	builtin $(builtin -l | awk -F "/" '/\/opt/ {print $5}') # Load all /opt/ast/bin builtins
 | 
					do	case $bltin in
 | 
				
			||||||
	for name in $(builtin -l | grep -Ev '(echo|/opt|test|true|false|getconf|uname|\[|:)'); do
 | 
						echo | test | true | false | \[ | : | getconf | */getconf | uname | */uname)
 | 
				
			||||||
	    actual=$({ "$name" --this-option-does-not-exist; } 2>&1)
 | 
							continue ;;
 | 
				
			||||||
	    expect="Usage: $name"
 | 
						/*/*)	expect="Usage: ${bltin##*/} "
 | 
				
			||||||
	    [[ $actual =~ $expect ]] || err_exit "$name should show usage info on unrecognized options (expected $(printf '%q' "$expect"), got $(printf '%q' "$actual"))"
 | 
							actual=$({ PATH=${bltin%/*}; "${bltin##*/}" --this-option-does-not-exist; } 2>&1) ;;
 | 
				
			||||||
	done
 | 
						*/*)	err_exit "strange path name in 'builtin' output: $(printf %q "$bltin")"
 | 
				
			||||||
)
 | 
							continue ;;
 | 
				
			||||||
 | 
						*)	expect="Usage: $bltin "
 | 
				
			||||||
 | 
							actual=$({ "${bltin}" --this-option-does-not-exist; } 2>&1) ;;
 | 
				
			||||||
 | 
						esac
 | 
				
			||||||
 | 
						[[ $actual == *"$expect"* ]] || err_exit "$bltin should show usage info on unrecognized options" \
 | 
				
			||||||
 | 
								"(expected string containing $(printf %q "$expect"), got $(printf %q "$actual"))"
 | 
				
			||||||
 | 
					done 3< <(builtin)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ======
 | 
					# ======
 | 
				
			||||||
exit $((Errors<125?Errors:125))
 | 
					exit $((Errors<125?Errors:125))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue