fix EVAL test

This commit is contained in:
Gwenhael Le Moine 2021-11-18 12:11:19 +01:00
parent 18131d462d
commit cc99b517a7
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 6 additions and 3 deletions

View file

@ -10,8 +10,9 @@ module Rpn
# we trim enclosing «» # we trim enclosing «»
parsed_input = Rpn::Parser.new.parse_input( args[0][:value][1..-2] ) parsed_input = Rpn::Parser.new.parse_input( args[0][:value][1..-2] )
stack, dictionary = Rpn::Runner.new.run_input( stack, dictionary, parsed_input ) stack, _dictionary = Rpn::Runner.new.run_input( stack, dictionary, parsed_input )
# TODO: check that STO actually updates dictionary # TODO: check that STO actually updates dictionary
stack stack
end end
end end

View file

@ -10,8 +10,10 @@ require_relative '../lib/runner'
class TestParser < Test::Unit::TestCase class TestParser < Test::Unit::TestCase
def test_eval def test_eval
stack, _dico = Rpn::Core::Program.eval( [{ value: '« 2 dup * »', type: :program }], Rpn::Dictionary.new ) stack = Rpn::Core::Program.eval( [{ value: '« 2 dup * dup »', type: :program }], Rpn::Dictionary.new )
assert_equal [{ value: 4, type: :numeric }],
assert_equal [{ value: 4, type: :numeric },
{ value: 4, type: :numeric }],
stack stack
end end
end end