1# grouping-y.tst: yash-specific test of grouping commands 2 3test_oE 'effect of empty subshell' 4echo 1 5() 6echo 2 7__IN__ 81 92 10__OUT__ 11 12test_OE -e 11 'exit status of empty subshell' 13sh -c 'exit 11' 14() 15__IN__ 16 17test_oE 'effect of empty brace grouping' 18echo 1 19{ } 20echo 2 21__IN__ 221 232 24__OUT__ 25 26test_OE -e 13 'exit status of empty brace grouping' 27sh -c 'exit 13' 28{ } 29__IN__ 30 31( 32posix="true" 33 34test_OE -e 0 '} after )' 35# In a literal interpretation of POSIX XCU 2.4, this should be a syntax error 36# because } does not follow any reserved word. However, no known shell rejects 37# this. 38{ (:) } 39__IN__ 40 41test_OE -e 0 ') after }' 42# This is of course OK. 43( { :; } ) 44__IN__ 45 46test_Oe -e 2 'empty subshell (single line)' 47() 48__IN__ 49syntax error: commands are missing between `(' and `)' 50__ERR__ 51#'`'` 52 53test_Oe -e 2 'empty subshell (multi-line)' 54( 55) 56__IN__ 57syntax error: commands are missing between `(' and `)' 58__ERR__ 59#'`'` 60 61test_Oe -e 2 'empty brace grouping (single line)' 62{ } 63__IN__ 64syntax error: commands are missing between `{' and `}' 65__ERR__ 66#'`'` 67 68test_Oe -e 2 'empty brace grouping (multi-line)' 69{ 70} 71__IN__ 72syntax error: commands are missing between `{' and `}' 73__ERR__ 74#'`'` 75 76) 77 78test_Oe -e 2 'unpaired )' 79) 80__IN__ 81syntax error: encountered `)' without a matching `(' 82__ERR__ 83#'`'` 84 85test_Oe -e 2 'unpaired }' 86} 87__IN__ 88syntax error: encountered `}' without a matching `{' 89__ERR__ 90#'`'` 91 92test_Oe -e 2 'unclosed subshell' 93( 94echo foo 95__IN__ 96syntax error: `)' is missing 97__ERR__ 98#'` 99 100test_Oe -e 2 'unclosed brace grouping' 101{ 102echo foo 103__IN__ 104syntax error: `}' is missing 105__ERR__ 106#'` 107 108test_Oe -e 2 'unclosed subshell in brace grouping' 109{ ( } 110__IN__ 111syntax error: encountered `}' without a matching `{' 112syntax error: (maybe you missed `)'?) 113__ERR__ 114#'`'`'` 115 116test_Oe -e 2 'unclosed brace grouping in subshell' 117( { ) 118__IN__ 119syntax error: encountered `)' without a matching `(' 120syntax error: (maybe you missed `}'?) 121__ERR__ 122#'`'`'` 123 124test_Oe -e 2 'simple command followed by (' 125echo foo ( 126:) 127__IN__ 128syntax error: invalid use of `(' 129__ERR__ 130#'` 131 132# vim: set ft=sh ts=8 sts=4 sw=4 noet: 133