rpl.rb/spec/words_string-list_spec.rb

23 lines
526 B
Ruby
Raw Normal View History

# coding: utf-8
# frozen_string_literal: true
2022-02-17 15:09:29 +01:00
require 'minitest/autorun'
2022-02-15 17:06:19 +01:00
require 'rpl'
2022-08-31 13:19:35 +02:00
class TestLanguageStringAndList < MiniTest::Test
2022-02-26 18:53:39 +01:00
include Types
2021-12-15 13:32:48 +01:00
def test_rev
2022-02-10 14:50:59 +01:00
interpreter = Rpl.new
interpreter.run '"my string to sub" rev'
2022-02-28 11:40:47 +01:00
assert_equal [Types.new_object( RplString, '"my string to sub"'.reverse )],
interpreter.stack
2021-12-15 13:32:48 +01:00
2022-02-10 14:50:59 +01:00
interpreter = Rpl.new
2022-08-31 13:19:35 +02:00
interpreter.run '{ 1 2 3 } rev'
assert_equal [Types.new_object( RplList, '{ 3 2 1 }' )],
interpreter.stack
2021-12-15 13:32:48 +01:00
end
end