diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/migrate_ref_tests.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/migrate_ref_tests.rb b/scripts/migrate_ref_tests.rb new file mode 100755 index 00000000..b6c89bfe --- /dev/null +++ b/scripts/migrate_ref_tests.rb @@ -0,0 +1,21 @@ +#!/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 |