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

     1  # should support the -update flag
     2  
     3  unquote in.txt res.txt
     4  
     5  # Should be an error to use -u with only stdin
     6  stdin in.txt
     7  ! testscript -u
     8  stderr 'cannot use -u when reading from stdin'
     9  
    10  # It is ok to use -u when reading from stdin and
    11  # a regular file
    12  testscript -u - in.txt
    13  cmp in.txt res.txt
    14  
    15  -- in.txt --
    16  >exec printf 'hello\n'
    17  >cmp stdout stdout.txt
    18  >
    19  >-- .gomodproxy/fruit.com_v1.0.0/.mod --
    20  >module fruit.com
    21  >
    22  >-- .gomodproxy/fruit.com_v1.0.0/.info --
    23  >{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"}
    24  >
    25  >-- .gomodproxy/fruit.com_v1.0.0/go.mod --
    26  >module fruit.com
    27  >
    28  >-- stdout.txt --
    29  >goodbye
    30  >-- .gomodproxy/fruit.com_v1.0.0/fruit/fruit.go --
    31  >package fruit
    32  >
    33  >const Apple = "apple"
    34  >-- .gomodproxy/fruit.com_v1.0.0/coretest/coretest.go --
    35  >// package coretest becomes a candidate for the missing
    36  >// core import in main above
    37  >package coretest
    38  >
    39  >const Mandarin = "mandarin"
    40  -- res.txt --
    41  >exec printf 'hello\n'
    42  >cmp stdout stdout.txt
    43  >
    44  >-- .gomodproxy/fruit.com_v1.0.0/.mod --
    45  >module fruit.com
    46  >
    47  >-- .gomodproxy/fruit.com_v1.0.0/.info --
    48  >{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"}
    49  >
    50  >-- .gomodproxy/fruit.com_v1.0.0/go.mod --
    51  >module fruit.com
    52  >
    53  >-- stdout.txt --
    54  >hello
    55  >-- .gomodproxy/fruit.com_v1.0.0/fruit/fruit.go --
    56  >package fruit
    57  >
    58  >const Apple = "apple"
    59  >-- .gomodproxy/fruit.com_v1.0.0/coretest/coretest.go --
    60  >// package coretest becomes a candidate for the missing
    61  >// core import in main above
    62  >package coretest
    63  >
    64  >const Mandarin = "mandarin"