This adds an updater to lit's --update-tests flag with support for `diff`. If a RUN line containing the `diff` command fails, this function will use heuristics to try to deduce which file is the "reference" file, and copy the contents of the other file to the reference. If it cannot deduce which file is the reference file, it does nothing. The heuristics are currently: - does one of the files end in .expected while the other does not? Then the .expected file is the reference. - does one of the file paths contain the substring ".tmp" while the other does not? Then the file not containing ".tmp" is the reference. This matches cases where one file path is constructed using the `%t` substitution.
8 lines
178 B
Plaintext
8 lines
178 B
Plaintext
# RUN: mkdir %t
|
|
# RUN: cp %S/1.in %t/1.txt
|
|
# RUN: cp %S/2.in %t/2.txt
|
|
|
|
# There is no indication here of which file is the reference file to update
|
|
# RUN: diff %t/1.txt %t/2.txt
|
|
|