diff options
| -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) |
