libkernaux/bindings/mruby/test/printf.rb

39 lines
924 B
Ruby
Raw Normal View History

2022-05-24 14:31:21 +00:00
# TODO: implement this
# rubocop:disable Style/BlockComments
=begin
assert 'KernAux.sprintf' do
[
['', 'using regular tests'],
['_orig', 'using original tests'],
].each do |(suffix, description)|
assert description do
printf_yml =
2022-05-28 00:07:14 +00:00
File.expand_path("../../../../common/printf#{suffix}.yml", __FILE__)
2022-05-24 14:31:21 +00:00
YAML.load(File.read(printf_yml)).each do |test|
expected = test['result']
args = test['args'].map do |arg|
if arg.is_a? String
arg
else
arg.map do |item|
if item.is_a? Array
item[0]
else
item
end
end
end
end
2022-05-24 14:31:21 +00:00
assert "transforms #{args.inspect} to #{expected.inspect}" do
assert_equal expected, KernAux.sprintf(*args)
end
end
end
end
end
=end
# rubocop:enable Style/BlockComments