diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-06-21 16:27:08 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-06-21 20:30:40 +0000 |
| commit | 23e1c69717e4182967e962ea06df659e7c7e9d29 (patch) | |
| tree | fa0be940ce1d24b8869270e82f22dca652bac2f9 | |
| parent | 4be594a5256adcc7b0114dde37b1d5455e6fb409 (diff) | |
[ruby/yarp] Fix snapshot checking
https://github.com/ruby/yarp/commit/05a60a0774
| -rw-r--r-- | test/yarp/parse_test.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/yarp/parse_test.rb b/test/yarp/parse_test.rb index ba8639c3bb..33f78bda8c 100644 --- a/test/yarp/parse_test.rb +++ b/test/yarp/parse_test.rb @@ -75,12 +75,15 @@ class ParseTest < Test::Unit::TestCase assert_empty result.errors, value if File.exist?(snapshot) - expected = File.read(snapshot) - normalized = normalize_printed(expected) - if expected != normalized + normalized = normalize_printed(File.binread(snapshot)) + + # If the snapshot file exists, but the printed value does not match the + # snapshot, then update the snapshot file. + if normalized != printed File.write(snapshot, normalized) warn("Updated snapshot at #{snapshot}.") end + # If the snapshot file exists, then assert that the printed value # matches the snapshot. assert_equal(normalized, printed) |
