github.com/rogpeppe/go-internal@v1.12.1-0.20240509064211-c8567cf8e95f/cmd/testscript/testdata/env_values.txt (about)

     1  # Test that passing env values, e.g. ENV1=val, works
     2  
     3  unquote test.txt
     4  
     5  env BLAH1=
     6  env BLAH2=junk
     7  
     8  # Normal operation
     9  testscript -e BLAH1=rubbish -e BLAH2 test.txt
    10  
    11  # It is an error to specify WORK. Note the error message
    12  # appears on stdout because it is written to the log output
    13  # of testscript, which has no concept of stderr.
    14  ! testscript -e BLAH1=rubbish -e BLAH2 -e WORK test.txt
    15  stdout 'cannot override WORK variable'
    16  
    17  -- test.txt --
    18  >exec printf $BLAH1'\n'
    19  >cmp stdout stdout1.txt
    20  >
    21  >exec printf $BLAH2'\n'
    22  >cmp stdout stdout2.txt
    23  >
    24  >-- stdout1.txt --
    25  >rubbish
    26  >-- stdout2.txt --
    27  >junk