1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00
alacritty/scripts/migrate_ref_tests.rb
Joe Wilm 98a1f7f508 Make tests compile again
Some tests are still not passing, though.

A migration script was added to migrate serialized grids from
pre-scrollback to the current format. The script is included with this
commit for completeness, posterity, and as an example to be used in the
future.

A few tests in grid/tests.rs were removed due to becoming irrelevant.
2018-04-02 10:10:22 -07:00

21 lines
461 B
Ruby
Executable file

#!/usr/bin/env ruby
require 'json'
Dir.glob('./tests/ref/**/grid.json').each do |path|
# Read contents
s = File.open(path) { |f| f.read }
# Parse
grid = JSON.parse(s)
# Check if it's already migrated / make this migration idempotent
next if grid['raw'][0][0].is_a? Array
# Transform
grid['raw'].reverse!
grid['raw'] = [grid['raw'], 0, grid['lines'] - 1]
# Write updated grid
File.open(path, 'w') { |f| f << JSON.generate(grid) }
end