rubyx/test/support/preloader.rb
Torsten Rüger 4bf23defc8 fix many tests with preloading
preloading, something akin to builtin, loads some very small predefined (macro) methods for the tests to work (ie call)
2019-09-12 22:27:26 +03:00

21 lines
534 B
Ruby

module Preloader
def builtin
{
"Integer.div4" => "def div4; X.div4;end",
"Integer.ge" => "def >; X.comparison(:>);end",
"Object.get" => "def get_internal_word(at); X.get_internal_word;end",
}
end
def get_preload(preload)
return "" unless preload
preload.split(";").collect do |loads|
raise "no preload #{loads}" unless builtin[loads]
clazz , meth = loads.split(".")
"class #{clazz}; #{builtin[loads]};end;"
end.join
end
def preload
get_preload(@preload)
end
end