add two regression tests from Debian posh, adjusted to pass with ksh93
This commit is contained in:
		
							
								
								
									
										32
									
								
								check.t
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								check.t
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| # $MirOS: src/bin/mksh/check.t,v 1.326 2009/10/15 14:58:50 tg Exp $ | ||||
| # $MirOS: src/bin/mksh/check.t,v 1.327 2009/10/15 15:23:41 tg Exp $ | ||||
| # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ | ||||
| # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ | ||||
| # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ | ||||
| @@ -6607,3 +6607,33 @@ stdin: | ||||
| expected-stdout: | ||||
| 	foo\x40bar-e \tbaz | ||||
| --- | ||||
| name: utilities-getopts-1 | ||||
| description: | ||||
| 	getopts sets OPTIND correctly for unparsed option | ||||
| stdin: | ||||
| 	set -- -a -a -x | ||||
| 	while getopts :a optc; do | ||||
| 	    echo "OPTARG=$OPTARG, OPTIND=$OPTIND, optc=$optc." | ||||
| 	done | ||||
| 	echo done | ||||
| expected-stdout: | ||||
| 	OPTARG=, OPTIND=2, optc=a. | ||||
| 	OPTARG=, OPTIND=3, optc=a. | ||||
| 	OPTARG=x, OPTIND=4, optc=?. | ||||
| 	done | ||||
| --- | ||||
| name: utilities-getopts-2 | ||||
| description: | ||||
| 	Check OPTARG | ||||
| stdin: | ||||
| 	set -- -a Mary -x | ||||
| 	while getopts a: optc; do | ||||
| 	    echo "OPTARG=$OPTARG, OPTIND=$OPTIND, optc=$optc." | ||||
| 	done | ||||
| 	echo done | ||||
| expected-stdout: | ||||
| 	OPTARG=Mary, OPTIND=3, optc=a. | ||||
| 	OPTARG=, OPTIND=4, optc=?. | ||||
| 	done | ||||
| expected-stderr-pattern: /.*-x.*option/ | ||||
| --- | ||||
|   | ||||
		Reference in New Issue
	
	Block a user