summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-03-09 13:49:47 -0800
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commitb0f655ac85ab6d86e9e482cbb9035200c6f08d40 (patch)
tree7cc0ec0a6d7f855557886bf0ab36b6217421af66 /scripts
parent688cabefc0bfc3224189c10235668eae5e5b0101 (diff)
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.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/migrate_ref_tests.rb21
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