Skip to content

Commit cf99a15

Browse files
author
webdev778
committed
Introduce maps_debug_correctness script
1 parent 610b3d5 commit cf99a15

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

ruby/bin/maps_debug_step_by_step

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env ruby
2+
ENV["INTERSCRIPT_STAGING"] = "1"
3+
require "bundler/setup"
4+
require "interscript"
5+
require "interscript/compiler/ruby"
6+
7+
# This script has been written because there are some differences between platforms
8+
# (ie. windows vs linux) that we wish to find out more about
9+
10+
if ARGV[0] == '-b'
11+
require 'base64'
12+
$b64 = []
13+
ARGV.shift
14+
end
15+
16+
map = ARGV[0]
17+
m = Interscript.parse(map)
18+
cr = Interscript::Compiler::Ruby
19+
mr = cr.(map, debug: true)
20+
21+
m.tests.data.each_with_index do |(from, expected), idx|
22+
r = mr.(from)
23+
24+
unless ARGV[1] && ARGV[1].to_i == idx
25+
if r == expected
26+
cr.reset_debug_data
27+
next
28+
end
29+
end
30+
31+
dr = cr.read_debug_data
32+
33+
if $b64
34+
$b64 << [idx, dr]
35+
else
36+
pp [idx, dr]
37+
end
38+
39+
cr.reset_debug_data
40+
end
41+
42+
if $b64
43+
puts Base64.encode64($b64.inspect)
44+
end

0 commit comments

Comments
 (0)