# Test that passing env values, e.g. ENV1=val, works

unquote test.txt

env BLAH1=
env BLAH2=junk

# Normal operation
testscript -e BLAH1=rubbish -e BLAH2 test.txt

# It is an error to specify WORK. Note the error message
# appears on stdout because it is written to the log output
# of testscript, which has no concept of stderr.
! testscript -e BLAH1=rubbish -e BLAH2 -e WORK test.txt
stdout 'cannot override WORK variable'

-- test.txt --
>exec printf $BLAH1'\n'
>cmp stdout stdout1.txt
>
>exec printf $BLAH2'\n'
>cmp stdout stdout2.txt
>
>-- stdout1.txt --
>rubbish
>-- stdout2.txt --
>junk
