rpl.rb/spec/language_time-date_spec.rb

36 lines
695 B
Ruby
Raw Normal View History

# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
2022-02-15 17:06:19 +01:00
require 'rpl'
2021-11-23 13:00:42 +01:00
class TestLanguageTimeDate < Test::Unit::TestCase
def test_time
now = Time.now.to_s
2022-02-10 14:50:59 +01:00
interpreter = Rpl.new
interpreter.run 'time'
assert_equal [{ value: now, type: :string }],
interpreter.stack
end
def test_date
now = Date.today.to_s
2022-02-10 14:50:59 +01:00
interpreter = Rpl.new
interpreter.run 'date'
assert_equal [{ value: now, type: :string }],
interpreter.stack
end
def test_ticks
2022-02-10 14:50:59 +01:00
interpreter = Rpl.new
interpreter.run 'ticks'
# TODO: better test, but how?
assert_equal :numeric,
interpreter.stack[0][:type]
end
end