2014-06-25 14:20:46 +02:00
|
|
|
require_relative '../helper'
|
|
|
|
require 'parslet/convenience'
|
|
|
|
|
2015-07-02 09:44:44 +02:00
|
|
|
|
2015-09-19 21:24:57 +02:00
|
|
|
Bosl::Compiler.class_eval do
|
2014-06-25 14:20:46 +02:00
|
|
|
|
2014-07-30 20:07:48 +02:00
|
|
|
def check
|
2015-07-18 14:28:57 +02:00
|
|
|
Virtual.machine.boot.compile_main @string_input
|
|
|
|
produced = Virtual.machine.space.get_main.source
|
|
|
|
assert_equal @output , produced
|
2015-07-19 10:15:38 +02:00
|
|
|
Virtual.machine.run_passes
|
2014-06-25 14:20:46 +02:00
|
|
|
end
|
2015-05-05 13:04:37 +02:00
|
|
|
|
2014-06-25 14:20:46 +02:00
|
|
|
end
|
2015-06-01 16:31:35 +02:00
|
|
|
|
2015-05-24 17:05:20 +02:00
|
|
|
class UnusedSofEquality
|
|
|
|
# simple thought: don't recurse for Blocks, just check their names
|
|
|
|
def == other
|
|
|
|
return false unless other.class == self.class
|
|
|
|
Sof::Util.attributes(self).each do |a|
|
|
|
|
begin
|
|
|
|
left = send(a)
|
|
|
|
rescue NoMethodError
|
|
|
|
next # not using instance variables that are not defined as attr_readers for equality
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
right = other.send(a)
|
|
|
|
rescue NoMethodError
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
return false unless left.class == right.class
|
|
|
|
if( left.is_a? Block)
|
|
|
|
return false unless left.name == right.name
|
|
|
|
else
|
|
|
|
return false unless left == right
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|